Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upcmd/go: run gives conflicting advice when using path@version syntax #29415
Comments
This comment has been minimized.
This comment has been minimized.
Thank you for this report @davecheney! |
This comment has been minimized.
This comment has been minimized.
Seems to not be working for me, either:
|
This comment has been minimized.
This comment has been minimized.
Hit this as well in #29575. Closing that as duplicate. |
This comment has been minimized.
This comment has been minimized.
Only go get and module-manipulation commands take path@version. |
This comment has been minimized.
This comment has been minimized.
Go get does not take path@version for me. I've filed #29659, since that appears to be different from the |
This comment has been minimized.
This comment has been minimized.
Can someone take a look at this please? Example from https://golang.org/cmd/go/#hdr-Module_aware_go_get which is This is breaking go-get’s ability as a package manager as the support for the |
This comment has been minimized.
This comment has been minimized.
@ahmetb, this issue is about the diagnostic messages. If That said, from the detail in #29575 it appears that you are, in fact, running in
|
This comment has been minimized.
This comment has been minimized.
@bcmills I'm still seeing this despite I'm not running in GOPATH mode. Here's a minimal repro with go1.12
# unset all env vars, with the exception of $HOME (mock it) and $PATH (inherit it)
env -i HOME="$PWD/mock-home" PATH="$PATH" go build -o ./httpstat github.com/davecheney/httpstat
go: finding github.com/davecheney/httpstat v1.0.0
go: downloading github.com/davecheney/httpstat v1.0.0
go: extracting github.com/davecheney/httpstat v1.0.0
...
(works)
Would you still suggest I'm in " |
This comment has been minimized.
This comment has been minimized.
@ahmetb, this issue is about the The advice from the commands you posted above does not conflict: it correctly indicates that, in module mode (which you are clearly in), you “can only use path@version syntax with 'go get'”. |
This comment has been minimized.
This comment has been minimized.
With Go 1.13, also running into
This is so annoying. Especially because it does not tell one what to do. |
This comment has been minimized.
This comment has been minimized.
From what I can tell, you just have to be in a package that has a go.mod file. Then you can get a particular version. |
What version of Go are you using (
go version
)?% go version
go version devel +97d5cb24b1 Sat Dec 22 09:37:04 2018 +0000 linux/amd64
Does this issue reproduce with the latest release?
unknown
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Go 1.12beta1 (tip) does not permit @Version syntax unless modules explicitly enabled, even if GOPATH is unset
What did you expect to see?
env GO111MODULE=on go run -v github.com/davecheney/httpstat@1.0.0
would download and build httpstat v1.0.0
What did you see instead?
Running without modules enabled tells me I must enable modules even thought I don't have GOPATH set. Running with modules enable tells me I must set GOPATH.
Setting both tells me that this isn't supported.
a. Can
go run path@version
be supported? If not, why not?b. Can the error messages be improved make it clearer sooner that the operation will not succeed once the correct permutation of environment variables is discovered.