A Setting is a single setting in the $GODEBUG environment variable.
type Setting struct {
// contains filtered or unexported fields
}
func New(name string) *Setting
New returns a new Setting for the $GODEBUG setting with the given name.
GODEBUGs meant for use by end users must be listed in ../godebugs/table.go, which is used for generating and checking various documentation. If the name is not listed in that table, New will succeed but calling Value on the returned Setting will panic. To disable that panic for access to an undocumented setting, prefix the name with a #, as in godebug.New("#gofsystrace"). The # is a signal to New but not part of the key used in $GODEBUG.
Note that almost all settings should arrange to call [IncNonDefault] precisely when program behavior is changing from the default due to the setting (not just when the setting is different, but when program behavior changes). See the internal/godebug package comment for more.
func (s *Setting) IncNonDefault()
IncNonDefault increments the non-default behavior counter associated with the given setting. This counter is exposed in the runtime/metrics value /godebug/non-default-behavior/<name>:events.
Note that Value must be called at least once before IncNonDefault.
func (s *Setting) Name() string
Name returns the name of the setting.
func (s *Setting) String() string
String returns a printable form for the setting: name=value.
func (s *Setting) Undocumented() bool
Undocumented reports whether this is an undocumented setting.
func (s *Setting) Value() string
Value returns the current value for the GODEBUG setting s.
Value maintains an internal cache that is synchronized with changes to the $GODEBUG environment variable, making Value efficient to call as frequently as needed. Clients should therefore typically not attempt their own caching of Value's result.