-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Module Path Error - "github.com/nats-io/nats.go" #940
Comments
I have no idea why that's happening. What is your Go version, and are you running |
|
There is no go.mod in this project. |
I have this same problem. |
@bionoren do you have a sample of the repo where you are running into this? This could be caused due to a dependency... I sent a PR some time ago to use the nats.go name of the repo, and the only place where this repo potentially references kit/transport/nats/subscriber_test.go Line 12 in 13ec75b
Rather than updating the path to use |
It's also used in the example file that araskachoi linked to: github.com/go-kit/kit/examples/stringsvc4/main.go. In a project using go modules that imports (directly or indirectly) go-kit/kit, if you run Should I be running |
Well, in Go 1.13...
So
That's because the /v2 suffix doesn't actually exist in the repo, but is rather an artifact of the Semantic Import Versioning requirement combined path/version magic tricks implemented by modules (I am rolling my eyes extremely hard right now). It can be fixed either by using the "v1" import path without the trailing suffix:
Or by explicitly turning on modules mode:
So I suspect something like that is happening here. But what confuses me is that the offending import path doesn't appear anywhere I can see. Can someone provide a complete, self-contained example project that demonstrates the problem, including instructions instructions for how to put it on my computer and get the error? I think that will involve: the complete output of |
I would be happy to accept a PR which did this, instead, as long as it was maintainable. |
I don't believe the error message would mention modules if I can reproduce it with a main package that imports the NATS client via its old name, and has a go.mod file. (The NATS Go client repo was renamed from go-nats to nats.go with v1.8.0.) Here is a Go playground reproducer. If you try to run that program in the playground, the output is
The error happens because Github automatically redirects the go tool to the new repository, but at the same time that the repo was renamed a
That leads me to this go-kit specific sequence of reproducing steps that start with checking out a commit of go-kit prior to when the NATS client import paths were updated.
Of course go-kit doesn't have a go.mod file today, so I had to include a step to add one, but the same would happen with Go 1.13 if there was a go.mod file in any parent directory of the go-kit location. |
One correction. Github no longer redirects requests for go-nats to the nats.go repo because the NATS project has restored the old go-nats repo in an archived state as of the 1.7.2 release. Thus the module path mismatch occurs with Go 1.13 because that version of Go uses the module proxy by default and the module proxy has a snapshot of the go-nats repo taken at a time when the repo had only been renamed and the Github auto redirect was active. That must have been the case up to and including v1.8.1 of the NATS go client. That's why This can be seen by either using Go 1.12 or setting the environment variable Here are some references if you want to read about all the problems the NATS project encountered due to the intersection of a repo rename and Go modules. |
Fixed it for me. Thanks for the workaround. 👍 |
Hey @theAkito , can you please help me to set the same environment in windows. I have also similar issue. |
when I do
go get
, the output islooks like it is here that the error is picking up on https://github.com/go-kit/kit/blob/master/examples/stringsvc4/main.go#L16
Any tips/workarounds/fixes?
The text was updated successfully, but these errors were encountered: