mirror of
https://github.com/golang/go
synced 2024-11-18 16:04:44 -07:00
tweaks to exvar.Map
R=dsymonds,rsc APPROVED=rsc DELTA=88 (53 added, 17 deleted, 18 changed) OCL=28452 CL=29008
This commit is contained in:
parent
80543aca7e
commit
89df071165
@ -66,6 +66,11 @@ func (v *Map) String() string {
|
||||
return string(b.Data())
|
||||
}
|
||||
|
||||
func (v *Map) Init() *Map {
|
||||
v.m = make(map[string] Var);
|
||||
return v
|
||||
}
|
||||
|
||||
func (v *Map) Get(key string) Var {
|
||||
v.mu.Lock();
|
||||
defer v.mu.Unlock();
|
||||
@ -157,8 +162,7 @@ func NewInt(name string) *Int {
|
||||
}
|
||||
|
||||
func NewMap(name string) *Map {
|
||||
v := new(Map);
|
||||
v.m = make(map[string] Var);
|
||||
v := new(Map).Init();
|
||||
Publish(name, v);
|
||||
return v
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user