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

Not seeing v2.0.0 for nats-io/nats.go #475

Closed
vangent opened this issue Jun 3, 2019 · 32 comments
Closed

Not seeing v2.0.0 for nats-io/nats.go #475

vangent opened this issue Jun 3, 2019 · 32 comments

Comments

@vangent
Copy link

vangent commented Jun 3, 2019

$ mkdir mymod
$ cd mymod
$ touch go.mod
$ go get github.com/nats-io/nats.go@latest
stat github.com/nats-io/nats.go: no such file or directory
$ go get github.com/nats-io/nats.go/@latest
$ cat go.mod
module mymod

go 1.12

require (
	github.com/nats-io/go-nats v1.7.2 // indirect
	github.com/nats-io/nats.go v1.7.2 // indirect
	github.com/nats-io/nkeys v0.0.2 // indirect
	github.com/nats-io/nuid v1.0.1 // indirect
)
$ 

Shouldn't it be v2.0.0?

@wallyqs
Copy link
Member

wallyqs commented Jun 3, 2019

I could reproduce, another issue is that the entry github.com/nats-io/go-nats should not be listed there and only github.com/nats-io/nats.go but instead both are listed...

@kozlovic
Copy link
Member

kozlovic commented Jun 3, 2019

We have some issues also with the nats server not be able to tag v2.0.0.. I am looking into that, but wonder if the issue is not due to circle dependencies.. Again, working on that, thanks!

@kozlovic
Copy link
Member

kozlovic commented Jun 3, 2019

Moving to a v2 was in my opinion a mistake (since we did not break backward compatibility in the client library). That being said, we would have to comply with the rule for go.mod for versions v2 and above. That is, go.mod should something like:

module github.com/nats-io/nats.go/v2

and all internal imports for /nats.go/<pkg> should have /nats.go/v2/<pkg>. Same for applications wanting to use the v2 release. Their import of nats.go should contain the v2 tag:

import "github.com/nats-io/nats.go/v2"

That would be required to use any API that is in v2 (for instance Message.Respond). If you don't do that, it would pull the latest 1.7.2 I am guessing.

Note that this is not done yet, and may require a 2.0.1 to fix the go.mod thing. We are discussing internally what we are going to do. Thanks!

@derekcollison
Copy link
Member

We put back to v1.8. Should work with that import now.

@vtolstov
Copy link

vtolstov commented Jun 4, 2019

After this tag v1.8.0 i have error:

go: github.com/nats-io/go-nats@v1.8.0: parsing go.mod: unexpected module path "github.com/nats-io/nats.go"
go: error loading module requirements

@vtolstov
Copy link

vtolstov commented Jun 4, 2019

(i'm try to go get github.com/nats-io/nats.go/@v1.8.0) but go mod tidy and go mod vendor display this message....

@kozlovic
Copy link
Member

kozlovic commented Jun 4, 2019

I think the issue now is with nats.go and stan.go libs not modified to change the nats-server v2 import as suggested here. I can work on that, but I am not 100% sure, so to test it means that I need to create a new tag to test the theory, which if prove wrong means I will have to delete the tag. What do you think?

@kozlovic
Copy link
Member

kozlovic commented Jun 4, 2019

@vangent As explained, we have downgraded to v1.8.0 (now v1.8.1).

Hopefully things are getting slowly resolved. There is still NATS Server that needs proper v2.0.0 release (right now still -RC19). Let me know if you still experience the issue.

If you do, you could also try to add this to your go.mod file (before or after the require()):

replace github.com/nats-io/go-nats => github.com/nats-io/nats.go v1.8.1

@vtolstov
Copy link

vtolstov commented Jun 4, 2019

thanks for hint

@kozlovic
Copy link
Member

kozlovic commented Jun 4, 2019

@vtolstov You mean that it worked only because of the replace statement?

@vtolstov
Copy link

vtolstov commented Jun 4, 2019

not, it working without this replace line

@kozlovic
Copy link
Member

kozlovic commented Jun 4, 2019

Ok, good to know.

@vangent
Copy link
Author

vangent commented Jun 5, 2019

I am still seeing that error:

$ cat go.mod
module gocloud.dev/pubsub/natspubsub

require (
	github.com/google/go-cmp v0.3.0
	github.com/nats-io/gnatsd v1.4.1
	github.com/nats-io/nats.go v1.8.0
	gocloud.dev v0.15.0
)

$ go mod tidy
go: github.com/nats-io/go-nats@v1.8.1: parsing go.mod: unexpected module path "github.com/nats-io/nats.go"
go: error loading module requirements

@kozlovic
Copy link
Member

kozlovic commented Jun 5, 2019

Yes, you are pulling gnatsd v1.4.1 that probably causes the old go-nats to be referenced. Try the replace trick to see if that does it for you. Add that at the end of your file.

replace github.com/nats-io/go-nats => github.com/nats-io/nats.go v1.8.1

@kozlovic
Copy link
Member

kozlovic commented Jun 5, 2019

alternatively, pull nats-serve 2.0.0 if you can.

@kozlovic
Copy link
Member

kozlovic commented Jun 5, 2019

and move to nats.go v1.8.1 too

@psiservices-scohen
Copy link

go get github.com/nats-io/nats.go@latest
stat github.com/nats-io/nats.go: no such file or directory

Cleared the mod cache, etc.

@kozlovic
Copy link
Member

kozlovic commented Jun 5, 2019

@psiservices-scohen We have documented that because of the unfortunate naming decision of the repo to be ending with .go, you should add / at the end. Try this:

go get github.com/nats-io/nats.go/@latest

Let me know if that works for you.

@psiservices-scohen
Copy link

Tried that - this is what I get:

go: github.com/nats-io/go-nats@v1.8.1: parsing go.mod: unexpected module path "github.com/nats-io/nats.go"
go: error loading module requirements

Is there something I should clear out?

@kozlovic
Copy link
Member

kozlovic commented Jun 5, 2019

Your go mod may be pulling older (pre repo rename) NATS client repo. If you can't clean up your go.mod, add this at the end as I just suggested to previous poster:

replace github.com/nats-io/go-nats => github.com/nats-io/nats.go v1.8.1

Does that work?

@psiservices-scohen
Copy link

Tried that -

github.com/nats-io/nats.go@v1.8.1 used for two different module paths (github.com/nats-io/go-nats and github.com/nats-io/nats.go)

Deleted go from my system, cleared the /pkg /bin folders, then reinstalled, same thing

@wallyqs
Copy link
Member

wallyqs commented Jun 5, 2019

@psiservices-scohen can you share your go mod? Here is an example of using the deps in a way that it works: https://github.com/wallyqs/hello-nats-go-mod/blob/master/go.mod

@psiservices-scohen
Copy link

module pass

go 1.12

require (
github.com/davecgh/go-spew v1.1.1
github.com/go-chi/chi v4.0.2+incompatible
github.com/go-chi/render v1.0.1
github.com/golang/snappy v0.0.1 // indirect
github.com/nats-io/go-nats v0.0.0-00010101000000-000000000000
github.com/nats-io/nats.go v1.8.1
github.com/rs/cors v1.6.0
github.com/spf13/viper v1.4.0
github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c // indirect
github.com/xdg/stringprep v1.0.0 // indirect
go.mongodb.org/mongo-driver v1.0.2
)

replace github.com/nats-io/go-nats => github.com/nats-io/nats.go v1.8.1

p.s. - Love your book - thanks!

@kozlovic
Copy link
Member

kozlovic commented Jun 5, 2019

Have you tried removing github.com/nats-io/go-nats v0.0.0-00010101000000-000000000000?

@kozlovic
Copy link
Member

kozlovic commented Jun 5, 2019

If you have applications using NATS you should update all your import paths for the new repo (nats.go instead of go-nats)

@psiservices-scohen
Copy link

Deleted the go .mod/.sum files and re-inited - added the replace... now it works. Thanks for the assist.

@kozlovic
Copy link
Member

kozlovic commented Jun 5, 2019

Still, I think you should go to the trouble of updating your import paths for nats.go and you may then not need the replace statement.

@psiservices-scohen
Copy link

WIll do -

@wallyqs
Copy link
Member

wallyqs commented Jun 6, 2019

Sharing in case anyone is still having issues such as:

go: github.com/nats-io/go-nats@v1.8.1: parsing go.mod: unexpected module path "github.com/nats-io/nats.go"
go: github.com/nats-io/go-nats-streaming@v0.5.0: parsing go.mod: unexpected module path "github.com/nats-io/stan.go"

To fix it:

  1. Update your go.mod using the latest tags, for example for both NATS and NATS Streaming clients:
module github.com/wallyqs/hello-nats-go-mod

go 1.12

require (
	github.com/nats-io/nats.go v1.8.1
	github.com/nats-io/stan.go v0.5.0
)

Or if want to import the NATS Server v2 to embed it, notice the /v2 after the nats-server module name. If that is not present, then go modules will not fetch it and would accidentally end up with 1.4.1 version of the server.

require (
	github.com/nats-io/nats-server/v2 v2.0.0
	github.com/nats-io/nats.go v1.8.1
)
  1. Next, update the imports within the repo:
find ./ -type f -name "*.go" -exec sed -i -e 's/github.com\/nats-io\/go-nats-streaming/github.com\/nats-io\/stan.go/g' {} \;

find ./ -type f -name "*.go" -exec sed -i -e 's/github.com\/nats-io\/go-nats/github.com\/nats-io\/nats.go/g' {} \;

find ./ -type f -name "*.go" -exec sed -i -e 's/github.com\/nats-io\/nats-server/github.com\/nats-io\/nats-server\/v2/g' {} \;
  1. (Recommended) Run Go fmt as that the rename will affect the proper ordering of the imports

@wallyqs
Copy link
Member

wallyqs commented Jun 6, 2019

@vangent for the go-cloud project, made this branch with the updated latest deps, sharing in case it helps: google/go-cloud@master...wallyqs:nats-deps

@vangent
Copy link
Author

vangent commented Jun 6, 2019

@wallyqs -- thanks! Updating the import paths for the server to /v2 works.

@wallyqs
Copy link
Member

wallyqs commented Jun 6, 2019

ok closing this one for now since v2.0.0 for nats.go has been removed too, thanks everyone for the feedback.

@wallyqs wallyqs closed this as completed Jun 6, 2019
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

6 participants