Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to Standard library Context package #420

Closed
GrimmKull opened this issue Dec 24, 2016 · 10 comments
Closed

Move to Standard library Context package #420

GrimmKull opened this issue Dec 24, 2016 · 10 comments
Assignees

Comments

@GrimmKull
Copy link

Context is now a Standard Go library. It is the same code as golang.org/x/net/context.
The only thing that is missing is ctxhttp used in only for HTTP microservice clients.

I have a suggestion. To add a new branch to the main go-kit repository that uses the standard Context package and the ctxhttp implementation.

The code with these changes is available in GrimmKull fork in a separate 1.7context branch.

What do you guys think?

P.S.:

If anyone wants to use this before it gets moved to the main repository you can use vendoring.

Example:

govendor fetch "github.com/go-kit/kit/endpoint::github.com/GrimmKull/kit/endpoint@1.7context"
@peterbourgon
Copy link
Member

Yep, I was waiting for 1.8 to drop and then make the switch in master. I'll start prepping for that now.

@willfaught
Copy link
Contributor

Can't wait!

@ziyadparekh
Copy link

How do we use go-kit with go version 1.7.4 in the meantime ?

@groob
Copy link
Contributor

groob commented Jan 11, 2017

@ziyadparekh you keep importing golang.org/x/net/context in your projects.

@ziyadparekh
Copy link

ziyadparekh commented Jan 11, 2017

@groob Thanks for the quick reply.

The main error it throws is that it cant find the context http package inside the http transport package. And when i try to go get the context http package, it throws an error because its not found? Any ideas on what I can do to circumvent these errors?

Apologies for all the questions, but getting the right environment set up is a real pain.

Here is the error:

../../go-kit/kit/transport/http/client.go:8:2: cannot find package "golang.org/x/net/context/ctxhttp" in any of:
	/usr/local/go/src/golang.org/x/net/context/ctxhttp (from $GOROOT)
	/Users/zparekh/Go/src/golang.org/x/net/context/ctxhttp (from $GOPATH)

@groob
Copy link
Contributor

groob commented Jan 11, 2017

Can you post the actual error getting instead of describing it?

The slack #go-kit channel might be a better place to debug this issue.

@ziyadparekh
Copy link

@groob Sorry about that. Posted the actual error in an edited version of the comment. I'll get myself set up on the Slack channel as well. In case you didnt see it, here is the error:

../../go-kit/kit/transport/http/client.go:8:2: cannot find package "golang.org/x/net/context/ctxhttp" in any of:
	/usr/local/go/src/golang.org/x/net/context/ctxhttp (from $GOROOT)
	/Users/zparekh/Go/src/golang.org/x/net/context/ctxhttp (from $GOPATH)

@willfaught
Copy link
Contributor

go get -u golang.org/x/net/context/ctxhttp works for me. It doesn't work for you?

@groob
Copy link
Contributor

groob commented Jan 11, 2017

We did a bit of an investigation on slack. It appears that you can run into some issues if you have $GOPATH/src/golang/org/x/net folder, but are missing the subdirectories go get starts to cause issues.

rm -rf go/src/golang.org/x/net/   

go get golang.org/x/net/context/ctxhttp

This resolves the issue for me, if anyone else runs into similar errors.

@peterbourgon peterbourgon mentioned this issue Jan 16, 2017
6 tasks
@peterbourgon
Copy link
Member

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants