cmd/go: work sync and mod vendor don't use other main modules in workspace #53904
Labels
GoCommand
cmd/go
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
WaitingForInfo
Issue is not actionable because of missing required information, which needs to be provided.
Milestone
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?
I'm using a go.work file that looks something like this:
Module a requires module b. I make changes to both a and b and everything works hunky-dory locally. However, my development process includes deploying the code to a google appengine instance on the cloud. I have not gotten this to work yet.
What did you expect to see?
I expected to be able to deploy the same code that is building and running locally to my test GAE instance.
What did you see instead?
Instead, I end up deploying the modified a with the old b which fails to build.
What I have tried
go mod vendor
go work sync
replace github.com/{me}/b => /home/{me}/gocode/src/b
replace github.com/{me}/b v0.0.3 => /home/{me}/gocode/src/b
go work sync
doesn't do anything to a's go.mod or add any other files to a.go work sync
replace github.com/{me}/b v0.0.3 => github.com/{me}/b v0.0.3-test
Conclusions
I can hear someone say workspaces are only supposed to make local development easier. Ridiculous.
go work sync
is worthless. It only updates indirect dependencies in the modules in the workspace, not for the actual modules I'm working on. I would expect the use directives to cause go work sync to either add a pseudo-version or a new tagged version to the go.mod files. It does neither. A replace directive also does neither and doesn't even do as much as replace directives do in the go.mod files.go mod vendor
understands replace directives in the go.mod files that point to local folders. It does not understand any kind of replace directives in the go.work file. It also doesn't understand go.work.sum files. We've been using go mod vendor to avoid all the replace directives for our many private repos, but these shortcomings negate that to large degree.Even if I do all my testing locally this still leaves me unable to test deployment without tagging new versions and this is still too early to be deciding on what should be added to the next version.
I hope I'm missing something because I was really excited about workspaces and they have been working wonderfully for local development. They seem worthless, though with so much potential, when it comes to anything else. I really hope this can be fixed.
The text was updated successfully, but these errors were encountered: