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: 'go build ...' builds all packages in my homedir when using modules #31063
Comments
In Go 1.12.1, any
So this should fetch and build a lot of things. That said, it shouldn't be scanning your entire laptop. Are you seeing this command build packages outside your repo that aren't published elsewhere? If so, can you narrow this down to a smaller test case we can look at? |
Thanks for clarifying the behavior of I admit that I didn't actually verify that it was the "entire laptop". I just know that it was hundreds of packages. Let me try to explain what I did a little clearer and you can tell me if this is intended behavior or not. I was in a file structure like this:
From the I then ran I then, bewildered, tried running Is this expected behavior of Thanks for your help! |
What you're describing sounds like intended behavior, though I admit it's a little surprising at first.
In general, it is expected that In GOPATH mode |
Thanks for writing all that up. Very helpful! Is this behavior detailed in such a way somewhere in official help? To parrot this back to you:
Questions:
Thanks again for your help. |
Right.
Right.
Not quite. What you're describing is the special
Right.
There's a bigger difference (covered above).
No extra work needed.
In GOPATH mode,
I'll close this issue because it seems like everything is working as intended, but feel free to reach out for more info on the golang-nuts mailing list or in the #modules channel on golang Slack. |
Thanks @jayconrod - you have been extremely helpful! |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I went into a directory where I wanted a module to live, which contained several levels of packages below it. I then attempted to run
go build ...
to build all packages recursively.What did you expect to see?
The used packages in all recursive package dependencies added to the module.
What did you see instead?
I saw that
go build ...
started downloading literally every package dependency it could find on my entire laptop, in any place in the home directory structure.This caused me to mistakenly open issue #31059
Running
go build ./...
properly builds recursively and adds the dependencies expected. This used to work without the leading./
without modules. I think we should maintain that behaviour instead of attempting to compile the user's entire laptop.The text was updated successfully, but these errors were encountered: