-
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
cmd/go: Setting up a go workspace breaks building #57738
Comments
Do any of the modules in your workspace use Does your workspace include its own version of the
|
Yes, as this is one repository with many modules they replace each other with relative parts if imported, i.E. the one that doesn't build anymore has one
We don't According to the Since everything works perfectly fine when not using |
What does |
This is different, on the branch with the I searched for that git sha and found that there is another module that does a Removing this module from Replace directives getting propagated from one module to the other when they don't import each other seems surprising to me, is this intentional? It somewhat defeats the purpose of having the multiple modules in the first place as the purpose of that was to be able to have different versions of dependencies. |
The workspace intentionally applies all of the
By design, a workspace can have only one set of consistent dependencies. (If you want to work with the dependencies of each module separately, don't combine them in a workspace.) |
I agree on that, I guess I would have expected a Thanks a lot for your help, really appreciate it! |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Added a
go.work
to a many-modules repository by executinggo work init
,go work use -r ./
at the root of the repository.Then tried building one of the modules and it failed:
executing the suggested command upgrades that module but that doesn't change anything about the issue:
That is what is in
go.mod
andgo.sum
regardinggolang.org/x/sys
:And this is the output of
go mod why
for that module:What did you expect to see?
A successful build, just like it works when not having a
go.work
fileWhat did you see instead?
Unfortunately this is a private repo, so I can not link to it. I am happy to provide any additional details that would help.
The text was updated successfully, but these errors were encountered: