浏览代码

fix context bug

dcsunny 4 年之前
父节点
当前提交
d495c08a70
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      common/context.go

+ 3 - 3
common/context.go

@@ -14,9 +14,9 @@ func NewContext(parentCtx context.Context) context.Context {
 
 func NewContextWithAccountID(parentCtx context.Context, accountID int64) context.Context {
 	ctx := &AccountContext{ctx: parentCtx}
-	ctx = context2.AppendToContext(ctx, "user_id", accountID).(*AccountContext)
-	ctx = context2.AppendToContext(ctx, "account_id", accountID).(*AccountContext)
-	return ctx
+	newCtx := context2.AppendToContext(ctx, "user_id", accountID)
+	newCtx = context2.AppendToContext(ctx, "account_id", accountID)
+	return newCtx
 }
 
 type AccountContext struct {