go version)?1.11.1
yes
go env)?linux, and64
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."
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.
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.
Thanks for raising the issue. It is a duplicate of https://github.com/golang/go/issues/24250. Please have a look into that.
Thanks, @pcontaza, you saved my day, GO111MODULE=auto go get works perfectly
Most helpful comment
Thanks, @pcontaza, you saved my day,
GO111MODULE=auto go getworks perfectly