Go enables HTTP/2 by default and supports HTTP/3 via the x/net/http3 package, with GODEBUG settings available to disable HTTP/2.
Go supports HTTP/2 by default in the net/http package, and HTTP/3 requires the experimental golang.org/x/net/http3 package. To disable HTTP/2 for compatibility with buggy servers, set the GODEBUG environment variable to http2client=0 or http2server=0.
export GODEBUG=http2client=0,http2server=0
For HTTP/3, import the http3 package and use http3.ListenAndServe instead of the standard http.ListenAndServe.
Go automatically uses the faster HTTP/2 protocol for web traffic, but you can turn it off if a server is broken. HTTP/3 is an even newer, faster protocol that you must explicitly add to your code to use. Think of it like a car that shifts gears automatically, but you can force it into manual mode if the automatic transmission fails.