[Solved] Why there is two kind of context?

What is the difference of golang.org/x/net/context and package context? And why there is two of them? If they are similar why I can’t use the net context on the package context and vice versa?

Thanks.

x/net/context was moved into the standard library as context in Go version 1.7. See https://golang.org/doc/go1.7#context

I think both exist for backwards compatibility, but moving forward you should try to use the context package.

3 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.