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

go get does not install new packages/binaries when GO111MODULE=on #28309

Closed
pcostanza opened this issue Oct 22, 2018 · 2 comments
Closed

go get does not install new packages/binaries when GO111MODULE=on #28309

pcostanza opened this issue Oct 22, 2018 · 2 comments

Comments

@pcostanza
Copy link

What version of Go are you using (go version)?

1.11.1

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

linux, and64

What did you do?

When GO111MODULE=off, I can use go get to download and install a program. For example go get github.com/exascience/elprep (one of our repositories) downloads the source code and dependencies into $GOPATH/src/ and installs the main program into $GOPATH/bin/. This works no matter which folder I am doing this from. I don't have to be inside $GOPATH somewhere for this to work, or inside some other development folder.

This is especially nice for end users, because we can provide a very simple instruction with which they can create and install a binary.

When GO111MODULE=on, this doesn't work anymore. Instead, an error message is printed "cannot find main module."

What did you expect to see?

I believe that either (a) go get should still work as with GO111MODULE=off, or else (b) there should be some other command to allow for simple downloading source code and installing binaries, even when you are not actively developing some code.

For (a) it's probably acceptable if the source code is not downloaded into $GOPATH/src, but into the current folder (like with git clone for example). Maybe a mode that stashes the source code away in some hidden folder and only makes the binary available would also work.

What did you see instead?

See above.

I'm not 100% sure I'm not missing something. I also tried go install, without good results. We could expand the instructions for end users to call "git clone https://github.com/exascience/elprep.git && cd elprep && go install github.com/exascience/elprep/v4" - but that's less user-friendly. It would then also still be an issue that there is no single command that works for both GO111MODULE=on an =off.

This is not a very urgent issue, since with the default GO111MODULE=auto setting, everything works fine. This is just to create an awareness for a feature that would be missing once you deprecate GOPATH mode.

@agnivade
Copy link
Contributor

Thanks for raising the issue. It is a duplicate of #24250. Please have a look into that.

@ypapax
Copy link

ypapax commented Jun 24, 2019

Thanks, @pcontaza, you saved my day, GO111MODULE=auto go get works perfectly

@golang golang locked and limited conversation to collaborators Jun 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants