-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
x/vgo: go.mod files in subdirectories are ignored when building the whole directory #24605
Comments
Nice bug. The problem is that each build always runs in the context of a single top-level repo. There's no direct connection between the parent dir and the sub dir (it's not like the parent dir mentions the sub dir in a replace directive or other connection). At least for now I think the answer is that ./... should stop matching when it finds a directory containing a go.mod. That is, ./... can only match packages in the module where "." is, and sub would therefore be excluded. |
Thanks for the quick response! I think ideally, running But I'm also not 100% sure what users expect as outcome for building this way with multiple modules in the directory. |
Same need here on this repo: https://github.com/JFrogDev/gofrog |
Same here, don't want deps for individual adapters to pollute the top level https://github.com/tcolgate/hugot. (will push go.mod attempt later today if I get a chance) |
Change https://golang.org/cl/117257 mentions this issue: |
Change https://golang.org/cl/122397 mentions this issue: |
CL 117257 handled path patterns like ... or x/... but not file system patterns like ./... or ./x/... . Fixes golang/go#24605 again. Change-Id: Ia5337a3490dfb3626b0af35199ae732fca0ed476 Reviewed-on: https://go-review.googlesource.com/122397 Reviewed-by: Bryan C. Mills <[email protected]>
What version of Go are you using (
go version
)?go version go1.10 darwin/amd64 vgo:2018-02-20.1
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?What did you do?
In a new directory, create a simple go file and a go.mod file and use vgo to build it:
mkdir main cd main nano main.go
The output is as expected:
Next, in a subdirectory add another vgo module and build it:
mkdir sub cd sub nano sub.go
The output is as expected:
Now back in the parent directory, execute
vgo build ./...
and retrieve the now unexpectedly changed contents of the go.mod file:cd .. vgo build ./... cat go.mod
What did you expect to see?
What did you see instead?
The text was updated successfully, but these errors were encountered: