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

Cannot go get client #478

Closed
coffeefedora opened this issue Jun 4, 2019 · 55 comments
Closed

Cannot go get client #478

coffeefedora opened this issue Jun 4, 2019 · 55 comments
Assignees

Comments

@coffeefedora
Copy link

I have a project that is outside of the go src folder, I am running go 1.12.5 on windows amd64 (win10) This is my first attempt to use NATS, not a great start!

Getting this error:

go get github.com/nats-io/nats.go/
go: finding github.com/nats-io/nats.go v1.8.0
go: finding github.com/nats-io/nkeys v0.0.2
go: finding github.com/nats-io/nuid v1.0.1
go: finding golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9
CreateFile github.com/nats-io/nats.go: The system cannot find the path specified.

@jar3b
Copy link

jar3b commented Jun 4, 2019

I have a similar issue using linux (ubuntu 18.04)

$ go version
go version go1.12 linux/amd64
$ go get github.com/nats-io/nats.go/
stat github.com/nats-io/nats.go: no such file or directory

Removing ~/go/pkg/mod/github.com/nats-io folder doesn't solve the issue.

Also with vgo (import was specified as "github.com/nats-io/nats.go")

$go mod tidy
...
go: github.com/nats-io/[email protected]: parsing go.mod: unexpected module path "github.com/nats-io/nats.go"
go: error loading module requirements

@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?

@coffeefedora
Copy link
Author

coffeefedora commented Jun 4, 2019

Since you are doing a rename, may I ask why nats.go if it the trailing .go means having to end it with a /? I've never seen a go module do that, and it kinda ... smells.

Why not name it nats-client or something more indicative of what it is? (maybe nats-go)

Either way though, I am stuck which sucks because I was hoping to test nats today. :(

@jar3b
Copy link

jar3b commented Jun 4, 2019

@kozlovic, I think this is a good idea, i can test new tag as soon as possible. In the current situation build with 1.8.0 (latest) is still impossible with default configuration.

UPD: I tried to change the imports in go tests in fork and it all worked (with nats.go, but i think stan.go fix must be similar)

@kozlovic
Copy link
Member

kozlovic commented Jun 4, 2019

@coffeefedora About the naming, it is not my decision...

kozlovic added a commit that referenced this issue Jun 4, 2019
Otherwise, projects pulling nats.go end-up with issues.

Resovles #478

Signed-off-by: Ivan Kozlovic <[email protected]>
@jar3b
Copy link

jar3b commented Jun 4, 2019

Issue with nats.go solved in 1.8.1, waiting for stan.go to perform a complete test.

@kozlovic
Copy link
Member

kozlovic commented Jun 4, 2019

I think I need a nats-server v2.0.0-RC19 tag first (that will have the v2 requirement), then do the stan.go change. I wonder if that's enough or if I will have to have a nats-streaming-server change too...

@coffeefedora
Copy link
Author

coffeefedora commented Jun 4, 2019

i cleared my go.sum and go.mod files, and tried adding again. It is trying to pull down v1.8.1 but no joy

this is the error:

get github.com/nats-io/nats.go/
CreateFile github.com/nats-io/nats.go: The system cannot find the path specified.

@jar3b
Copy link

jar3b commented Jun 4, 2019

@coffeefedora i working with go mod (vgo) and it works correctly, but go get github.com/nats-io/nats.go/ still produces error. You can try go get github.com/nats-io/nats.go/@latest, in my case this command downloads package successfully.

@kozlovic
Copy link
Member

kozlovic commented Jun 4, 2019

@jar3b I need a v1.8.2 now because I just issued nats-server v2.0.0-RC19 that has proper go.mod with v2 requirements. If you build from docker (without any cache) then 1.8.1 will fail:

go: finding github.com/nats-io/nats.go v1.8.1
go: finding github.com/nats-io/nats-server/v2/server latest
go: downloading github.com/nats-io/nats.go v1.8.1
go: extracting github.com/nats-io/nats.go v1.8.1
go: finding github.com/nats-io/nats-server/v2 v2.0.0-RC8
go: downloading github.com/nats-io/nats-server/v2 v2.0.0-RC8
go: finding github.com/nats-io/nuid v1.0.1
go: finding github.com/nats-io/nkeys v0.0.2
go: finding golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9
go: downloading github.com/nats-io/nkeys v0.0.2
go: downloading github.com/nats-io/nuid v1.0.1
go: extracting github.com/nats-io/nuid v1.0.1
go: extracting github.com/nats-io/nkeys v0.0.2
go: downloading golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9
go: extracting golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9
build test: cannot load github.com/nats-io/nats-server/v2/server: cannot find module providing package github.com/nats-io/nats-server/v2/server

(the test app is importing v2 of the server. If it does not, then it would work ok.

@kozlovic
Copy link
Member

kozlovic commented Jun 4, 2019

As you see, 1.8.1 pulls RC8 that did not have go.mod modified for v2.

@kozlovic
Copy link
Member

kozlovic commented Jun 4, 2019

But this is insane.. I really don't get how this thing works...

(edit: nats.go's mod does not define the dependency to nats-server in the go.mod, and still it ends-up pulling rc8, why?)

@kozlovic
Copy link
Member

kozlovic commented Jun 4, 2019

@jar3b I have deleted the old tag of nats-server that was v2.0.0-RC8 that ended-up be picked up as the latest because alpha sorting wise, it was indeed the last.
I think it works now for a simple nats.go/nats-server project with and without v2 import paths.

But my guess is stan.go will be more complex because of nats-streaming-server using vendor with older gnatsd v1.4.1.. I can start with updating stan.go nats-server imports, but I believe that won't be enough.

@jar3b
Copy link

jar3b commented Jun 4, 2019

With test dockerfile

FROM golang:1.12.5-alpine3.9 as build
RUN apk add --no-cache git gcc musl-dev
ADD . /root/go/pkg/mod/github.com/jar3b/awesomeProject
WORKDIR /root/go/pkg/mod/github.com/jar3b/awesomeProject
RUN go mod tidy && go test && go build -o app main.go

FROM alpine:3.9
WORKDIR /w
COPY --from=build /root/go/pkg/mod/github.com/jar3b/awesomeProject/app .
RUN ls -l && chmod a+x app

CMD ["./app"]

and go.mod

module github.com/jar3b/awesomeProject

go 1.12

require (
	github.com/golang/protobuf v1.3.1 // indirect
	github.com/nats-io/nats-server/v2 v2.0.0-RC19 // indirect
	github.com/nats-io/nats.go v1.8.1
)

i got (20 min ago i got RC8, for now - RC19)

Step 5/10 : RUN go mod tidy && go build -o app main.go
 ---> Running in f0926f4b971d
go: finding github.com/nats-io/nats-server v1.4.1
go: finding github.com/nats-io/nats-server/v2 v2.0.0-RC19
go: finding github.com/nats-io/nats.go v1.8.1
go: finding github.com/golang/protobuf v1.3.1
go: finding github.com/nats-io/gnatsd v1.4.1
go: finding github.com/nats-io/nuid v1.0.1
go: finding github.com/nats-io/nkeys v0.0.2
go: finding golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9
go: finding golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5
go: finding github.com/nats-io/jwt v0.2.6
go: finding golang.org/x/sys v0.0.0-20190412213103-97732733099d
go: finding golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3
go: finding golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2
go: finding golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a
go: finding golang.org/x/text v0.3.0
go: downloading github.com/nats-io/nats.go v1.8.1
go: extracting github.com/nats-io/nats.go v1.8.1
go: downloading github.com/nats-io/nuid v1.0.1
go: downloading github.com/nats-io/nkeys v0.0.2
go: downloading github.com/nats-io/nats-server v1.4.1
go: downloading github.com/golang/protobuf v1.3.1
go: extracting github.com/nats-io/nuid v1.0.1
go: extracting github.com/nats-io/nkeys v0.0.2
go: downloading golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5
go: extracting github.com/nats-io/nats-server v1.4.1
go: extracting github.com/golang/protobuf v1.3.1
go: downloading github.com/nats-io/nats-server/v2 v2.0.0-RC19
go: extracting golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5
go: extracting github.com/nats-io/nats-server/v2 v2.0.0-RC19
go: downloading github.com/nats-io/jwt v0.2.6
go: downloading golang.org/x/sys v0.0.0-20190412213103-97732733099d
go: extracting github.com/nats-io/jwt v0.2.6
go: extracting golang.org/x/sys v0.0.0-20190412213103-97732733099d

I hope it's all correct now (for nats.go)

@kozlovic
Copy link
Member

kozlovic commented Jun 4, 2019

Yes, like I said, I deleted the old RC8 server tag that was being pulled as the latest. And it looks like nats.go works fine now. But I still get issues with sample app pulling streaming server/client...

@jar3b
Copy link

jar3b commented Jun 4, 2019

Yes, i can't go mod tidy with these imports too

import (
...
	"github.com/nats-io/nats.go"
	"github.com/nats-io/stan.go"
)

->

go: finding github.com/gogo/protobuf/proto latest
go: finding github.com/gogo/protobuf/gogoproto latest
go: finding github.com/nats-io/nats-streaming-server/server latest
go: finding github.com/nats-io/nats-server/test latest
go: finding github.com/hashicorp/go-msgpack/codec latest
go: finding github.com/nats-io/go-nats-streaming/pb latest
go: finding github.com/nats-io/gnatsd/server latest
go: finding github.com/nats-io/gnatsd/conf latest
go: finding github.com/nats-io/gnatsd/test latest
go: finding github.com/nats-io/gnatsd/logger latest
go: github.com/nats-io/[email protected]: parsing go.mod: unexpected module path "github.com/nats-io/nats.go"
go: error loading module requirements

@coffeefedora
Copy link
Author

@jar3b that worked, thank you sir.

But i saw a comment above that this is not the streaming client? both download links for nats and nats streaming go to the same github page...

@wallyqs
Copy link
Member

wallyqs commented Jun 4, 2019

@coffeefedora yes this the core NATS client, could you share where you found those links? Thanks!

@asim
Copy link

asim commented Jun 4, 2019

I'm now running into this

go: github.com/nats-io/[email protected] used for two different module paths (github.com/nats-io/go-nats and github.com/nats-io/nats.go)

@kozlovic
Copy link
Member

kozlovic commented Jun 4, 2019

@asim Are you having that on project that pulls stan.go? I am working on updating nats-streaming-server dependencies (nats-io/nats-streaming-server@dfa75d1). If from my stan.go repo I do GO111MODULE=on go get github.com/nats-io/nats-streaming-server@dfa75d1c9e9361f5565952b34d9ddbb046afa094 then the GO111MODULE=on go test -v -p=1 ./... I no longer get the error you reported.
So when I pushed streaming server 0.15.0 tag, that may resolve the issue.

@asim
Copy link

asim commented Jun 4, 2019

I'm only making use of nats.go but I can't account for other things in the dependency graph that might rely on them. When I pin to the old version 1.7.2 everything is fine.

@kozlovic
Copy link
Member

kozlovic commented Jun 4, 2019

All, did several repos updates, so would appreciate knowing if you guys still have issues. We have NATS Server that is still v2.0.0-RC19 and need to move to v2.0.0, which means that we will need NATS Streaming to issue v0.15.1 with updated dependency.
Something that you could try if you have some error messages about go-nats is to add this in your go.mod before or after the require() section:

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

@asim
Copy link

asim commented Jun 5, 2019

The replace statements do not actually fix the issue for me and the errors persist as

go: github.com/nats-io/[email protected] used for two different module paths (github.com/nats-io/go-nats and github.com/nats-io/nats.go)
go: github.com/nats-io/[email protected] used for two different module paths (github.com/nats-io/go-nats-streaming and github.com/nats-io/stan.go)

@wallyqs
Copy link
Member

wallyqs commented Jun 5, 2019

Hi @asim is it possible to get a link to the go.mod with that result? I made a sample here (including the nats-streaming-server as well though can remove it) and go run main.go and go mod tidy are working for me: https://github.com/wallyqs/hello-nats-go-mod/blob/master/go.mod

@asim
Copy link

asim commented Jun 5, 2019

I believe I've resolved this. We were depending on another package which separately had stan dependencies. Please accept as resolved.

@jar3b
Copy link

jar3b commented Jun 5, 2019

Building a test app (with both stan.go and nats.go) was resolved today after go mod tidy with:

...
require (
	github.com/golang/protobuf v1.3.1 // indirect
	github.com/nats-io/nats-streaming-server v0.15.0 // indirect
	github.com/nats-io/nats.go v1.8.1
	github.com/nats-io/stan.go v0.5.0
	google.golang.org/appengine v1.6.0 // indirect
)

Thanks!

@kozlovic
Copy link
Member

kozlovic commented Jun 5, 2019

Glad issue is resolved for all participants in this issue. Sorry again for the troubles.

@kozlovic kozlovic closed this as completed Jun 5, 2019
@wallyqs
Copy link
Member

wallyqs commented Jun 7, 2019

Filed in issue in golang/go about this: golang/go#32483

@dcarbone
Copy link

Not that it matters, but this has effectively prevented me from using anything other than the new, and utterly horrible, "mod" concept in go.

I, personally, hate this change and the massive amounts of my time that I will now have to waste managing go.mod replace blocks in every one of my projects that is now forced to use mod by way of using nats.

@wallyqs
Copy link
Member

wallyqs commented Jun 14, 2019

@dcarbone there is also an archived version of the repository with the old name of the project that is not using modules in case it helps: https://github.com/nats-io/go-nats

@dcarbone
Copy link

actually @wallyqs it was a litany of tangentially related issues that was the primary source of my anger this morning. so i apologize for displaying it here.

dep is absolutely OK with the new package path, and therefore i have nothing to be upset about.

again, apologies.

@wallyqs
Copy link
Member

wallyqs commented Jun 14, 2019

@dcarbone no worries, totally understand. glad to hear you could make it work with dep as well 👍

@yogihardi
Copy link

hi,

i still getting error, please check below:

$> GO111MODULE=on go get github.com/nats-io/nats.go/@latest
$> ls $GOPATH/src/github.com/nats-io/nats.go
ls: /Users/yogi/Documents/workspaces/go-project/src/github.com/nats-io/nats.go: No such file or directory
$> go version
go version go1.13.4 darwin/amd64 

@kozlovic
Copy link
Member

@yogihardi This is different. You are using go mod, so this is not going to be downloaded where you expect it to be if you were NOT using go mods. So do this instead and you should see it, along with the other nats-io deps that it may have pulled:

ls $GOPATH/pkg/mod/github.com/nats-io/

@tegk
Copy link

tegk commented Nov 27, 2019

does not work with go mods

go: teststand imports github.com/nats-io/go-nats: github.com/nats-io/[email protected]: parsing go.mod: module declares its path as: github.com/nats-io/nats.go but was required as: github.com/nats-io/go-nats

@yogihardi
Copy link

@yogihardi This is different. You are using go mod, so this is not going to be downloaded where you expect it to be if you were NOT using go mods. So do this instead and you should see it, along with the other nats-io deps that it may have pulled:

ls $GOPATH/pkg/mod/github.com/nats-io/

thanks @kozlovic
my problem was failed to ran go test with go module, not related to nats-io, my apologies..

@kozlovic
Copy link
Member

@tegk You probably have some other dependencies that still refer to go-nats instead of nats.go. If you can't update those (or ask upstream repo to do so), I believe that you may be able to locally solve by having this statement in your go.mod:

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

(note I use the latest version, v1.9.1, although in your error message it looks like you/they were still using v1.8.1).

@dancompton
Copy link

Sirupsen

@kozlovic
Copy link
Member

kozlovic commented Dec 9, 2019

@dan-compton Sorry but I am not sure what you mean by "Sirupsen". Did you mean to tag someone with that GitHub handle? If so, you did not (the @ is missing)..

@bcba25
Copy link

bcba25 commented Feb 29, 2020

@kozlovic dude this issue still exists until now, why cant use solve it properly ? I still getting this error no matter what I do

@wallyqs
Copy link
Member

wallyqs commented Feb 29, 2020

@bcba25 could you try with GOPROXY=direct? I think this might be solved in Go 1.14 too that is when modules became production ready

@bcba25
Copy link

bcba25 commented Mar 2, 2020

@wallyqs alright will give it a try, thanks

@jextrevor
Copy link

still seeing this issue when trying to do go get github.com/nats-io/nats.go:

$ go get github.com/nats-io/nats.go

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

@jextrevor
Copy link

getting the same error when using GOPROXY=direct

@jextrevor
Copy link

Was able to solve the error after running GOPROXY=direct go mod tidy and GOPROXY=direct go get -u all

@wallyqs
Copy link
Member

wallyqs commented May 6, 2020

@jextrevor thanks for sharing, looks there might still be some bugs in Go modules then...

@jextrevor
Copy link

still seeing this error...

@ripienaar
Copy link
Contributor

What version of go do you use @jextrevor ?

@jextrevor
Copy link

I'm using 1.13.1. I'm going to upgrade to 1.14.4 and see if the issue still exists there.

@wallyqs
Copy link
Member

wallyqs commented Jul 14, 2020

Upgrading to 1.14.4 and to a newer version of the Go client would help with this issue (anything that matches version 1.8.1 would get this error as well). Reason seems to be that the Go proxy has cached a version during the rename that won't go stale, skipping the proxy is another work around this issue as well.

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