Avoid Go performance pitfalls by controlling runtime behavior with GODEBUG settings and optimizing standard library usage like HTTP connection reuse. Set specific flags via the GODEBUG environment variable or //go:debug directives to disable expensive features or revert to older, faster behaviors when necessary.
export GODEBUG=http2client=0,http2server=0
For HTTP performance, ensure Transport.MaxIdleConns is set to a positive integer to enable connection reuse, or set Transport.DisableKeepAlives to true if reuse causes degradation in your specific workload.