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?
to your account
Spin off from #53933, where gopls did not present a workspace error for a problematic go.work file because the go command was happy.
The go command does not return an error for duplicate module paths in a go.work file. Instead, it happily lets the last directory win:
$ ls -R
go.work mod1 mod2
$ cat go.work
$ cat mod1/go.mod
$ cat mod2/go.mod
$ go list -m -json all
The text was updated successfully, but these errors were encountered:
We do check that the same directory doesn't appear multiple times:
However, we haven't parsed the actual go.mod files at that point and can't check for duplicate module directives.
Probably the right place to do this check is in the makeMainModules helper-function here:
Sorry, something went wrong.
i'm working on it. i will send a cl.
Change https://go.dev/cl/419557 mentions this issue: cmd/go/internal/modload: return error when duplicate module paths among modules in go.work
cmd/go/internal/modload: return error when duplicate module paths among modules in go.work
please feel free to review, thanks
No branches or pull requests