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 re
()
| 134 | // Clients should therefore typically not attempt their own |
| 135 | // caching of Value's result. |
| 136 | func (s *Setting) Value() string { |
| 137 | s.once.Do(func() { |
| 138 | s.setting = lookup(s.Name()) |
| 139 | if s.info == nil && !s.Undocumented() { |
| 140 | panic("godebug: Value of name not listed in godebugs.All: " + s.name) |
| 141 | } |
| 142 | }) |
| 143 | v := *s.value.Load() |
| 144 | if v.bisect != nil && !v.bisect.Stack(&stderr) { |
| 145 | return "" |
| 146 | } |
| 147 | return v.text |
| 148 | } |
| 149 | |
| 150 | // lookup returns the unique *setting value for the given name. |
| 151 | func lookup(name string) *setting { |
no test coverage detected