1
0
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:
Brendan O'Dea 2009-05-18 15:42:09 -07:00
parent 80543aca7e
commit 89df071165

View File

@ -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
}