-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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: unclear diagnostic when fetching requirements for other versions of workspace modules #54680
Comments
|
(That said, in general module paths without dots are reserved for the Go toolchain and standard library. I would suggest using module paths that begin with a domain name you control, even if you don't actually publish the modules to that domain.) |
I can reproduce the bug with the following script test (
The test currently fails with the message reported by @mbrancato:
|
Ah, no! The The error message here is (awkwardly!) telling you that the One solution in this case might be to leave the |
I understand that Go wants this named differently. Giving a hostname brings up other issues about internal libraries that are not published to an external repository. Basically, it now means you need to set |
I just noticed that my mentioned workaround only works for building a project. Commands like |
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?
./go.work
./libs/foo/go.mod
./projects/bar/go.mod
What did you expect to see?
Based on a number of expressive documents, the workspace proposal, and the workspace tutorial, I thought workspaces would be an alternative to the current usage of the
replace
directive in multiple modules in the same source tree.What did you see instead?
While the module location usage of
replace
is changed for the workspace, the module name is enforced. This is not howreplace
works today in when specified ingo.mod
. There, it replaces the location and the module name. This results in the following error in the modules:Again, this does not happen with the following in the
./projects/bar/go.mod
.The workaround to this appears to be that a
replace
directive must also be in thego.work
.However, it does seem that we're having to specify the override of the module name multiple times as it is in both the
go.work
file and the module's owngo.mod
. It took a bit of work to find this (before I saw an example ofreplace
used here) solution, and not really what I expected. But it does bring up the issue, if the module specifies its own name ingo.mod
, and the workspace knows how to access it, why do we need an explicitreplace
statement in thego.work
to simply reassert the name of the module?The text was updated successfully, but these errors were encountered: