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

cmd/go: 'install' succeeds without a main module when given a non-main package #30053

mvdan opened this issue Feb 1, 2019 · 3 comments


Copy link

commented Feb 1, 2019 works great, for the most part. I found this behavior, which confused me a bit.

$ go version
go version devel +faf187fb8e Thu Jan 31 16:55:43 2019 +0000 linux/amd64
$ export GO111MODULE=on
$ go env GOMOD
$ go install
$ echo $?
$ go list -f {{.Name}}

Sounds to me like this should error; install shouldn't behave just like get -d when given non-main packages.

Similarly, go get succeeds, but I presume it should fail. Only go get -d should succeed.

/cc @bcmills @myitcv


This comment has been minimized.

Copy link
Member Author

commented Feb 1, 2019

@rogpeppe points out that the root directory is a non-main package with some files, so the commands were actually doing something - presumably filling up the build cache.

However, perhaps there should be a way to globally say "install this binary", which would error if erroneously given non-main packages. I had run the wrong command, and I was confused for a while as to why no binary was being installed.

But perhaps it's just me who has been confused by this :)

@bcmills bcmills added this to the Unplanned milestone Feb 12, 2019


This comment has been minimized.

Copy link

commented Feb 12, 2019

We haven't seen many reports of confusion with this so I don't think it's a priority for 1.13, but perhaps we can revisit when folks are more used to go install not being a command that is ever particularly useful to run.


This comment has been minimized.

Copy link
Member Author

commented Mar 22, 2019

I think we could close this issue if we had the command for #30515 error when given non-main packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.