diff --git a/context/context.go b/context/context.go index a0ef5d4..d804168 100644 --- a/context/context.go +++ b/context/context.go @@ -10,7 +10,7 @@ func (c ContextKey) String() string { func NewContext(parent Context) Context { c := &defaultContext{ - parent: parent, + Context: parent, } c.attributes = make(map[string]interface{}) @@ -25,7 +25,7 @@ type Context interface { } type defaultContext struct { - parent Context + Context attributes map[string]interface{} mtx sync.RWMutex @@ -50,10 +50,10 @@ func (dc *defaultContext) GetAttribute(key string) (value interface{}) { return dc.attributes[key] } - if nil == dc.parent { + if nil == dc.Context { return nil } - return dc.parent.GetAttribute(key) + return dc.Context.GetAttribute(key) } func (dc *defaultContext) RemoveAttribute(key string) { @@ -67,11 +67,11 @@ func (dc *defaultContext) RemoveAttribute(key string) { return } - if nil == dc.parent { + if nil == dc.Context { return } - dc.parent.RemoveAttribute(key) + dc.Context.RemoveAttribute(key) } func (dc *defaultContext) ContainsAttribute(key string) (exist bool) { @@ -84,10 +84,10 @@ func (dc *defaultContext) ContainsAttribute(key string) (exist bool) { return true } - if nil == dc.parent { + if nil == dc.Context { return false } - return dc.parent.ContainsAttribute(key) + return dc.Context.ContainsAttribute(key) } func (dc *defaultContext) checkInitialized() {