Environment variables

Set the GODEBUG environment variable with key=value pairs to control Go runtime behavior and maintain backwards compatibility.

The GODEBUG environment variable controls specific runtime behaviors in Go programs by setting key=value pairs to opt into or out of compatibility changes. Set it as a comma-separated list before running your program to override defaults like HTTP/2 usage or panic behavior.

export GODEBUG=http2client=0,panicnil=1

You can also set defaults permanently in your go.mod file using the godebug block or in source files with //go:debug directives.