You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As executing gin applications, I just use golang.org/x/net/context for async process, such as sending logs with fluentd, or r/w databases. So I create ctx := context.Background(), but I cloud not call it because gin.GET(func)'s func has only one arg: *gin.Context, cloud not include ctx (= context.Context).
The text was updated successfully, but these errors were encountered:
ynqa
changed the title
how can I use golang.org/x/net/context in func()
how can I use golang.org/x/net/context in func xxx(c *gin.Context)?
Jul 4, 2016
Thus, it seems like you can only directly pass a gin.Context into code that expects a context.Context, not vice versa. You should also be able to derive a context.Context from a gin.Context.
From history, it looks like the gin experimentation with / introduction of context.Context occurred in May 2015, just before 1.0rc1.
If anyone has experience bridging / mixing gin.Context with context.Context, please share.
As executing gin applications, I just use golang.org/x/net/context for async process, such as sending logs with fluentd, or r/w databases. So I create
ctx := context.Background()
, but I cloud not call it becausegin.GET(func)
's func has only one arg:*gin.Context
, cloud not includectx
(= context.Context).The text was updated successfully, but these errors were encountered: