瀏覽代碼

Context.Get() does not need to test whether Keys is nil or not

Maxime Soulé 9 年之前
父節點
當前提交
bf8da4a08a
共有 1 個文件被更改,包括 1 次插入3 次删除
  1. 1 3
      context.go

+ 1 - 3
context.go

@@ -166,9 +166,7 @@ func (c *Context) Set(key string, value interface{}) {
 // Get returns the value for the given key, ie: (value, true).
 // If the value does not exists it returns (nil, false)
 func (c *Context) Get(key string) (value interface{}, exists bool) {
-	if c.Keys != nil {
-		value, exists = c.Keys[key]
-	}
+	value, exists = c.Keys[key]
 	return
 }