We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ccf0d88 commit 1a110b6Copy full SHA for 1a110b6
go/stats/export.go
@@ -100,17 +100,16 @@ func (vg *varGroup) publish(name string, v expvar.Var) {
100
vg.Lock()
101
defer vg.Unlock()
102
103
- // Check if the variable is already exported
104
- if _, ok := vg.vars[name]; ok {
+ // Check if the variable is already registered
+ if v := expvar.Get(name); v != nil {
105
return
106
}
107
-
108
expvar.Publish(name, v)
109
if vg.newVarHook != nil {
110
vg.newVarHook(name, v)
+ } else {
111
+ vg.vars[name] = v
112
113
- vg.vars[name] = v
114
115
116
var defaultVarGroup = varGroup{vars: make(map[string]expvar.Var)}
0 commit comments