Skip to content
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: go work sync corrupts go.sum #50038

Closed
hyangah opened this issue Dec 8, 2021 · 2 comments
Closed

cmd/go: go work sync corrupts go.sum #50038

hyangah opened this issue Dec 8, 2021 · 2 comments
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Milestone

Comments

@hyangah
Copy link
Contributor

hyangah commented Dec 8, 2021

What version of Go are you using (go version)?

 % gotip version
go version devel go1.18-cf1ec17360 Tue Dec 7 21:54:30 2021 +0000 darwin/amd64

What did you do?

Attempting to remove replace from golang.org/x/tools/gopls/go.mod,
set up the workspace like https://go-review.googlesource.com/c/tools/+/369959

% cat go.work 
go 1.18

use (
        ./.
        ./gopls
)

Then, ran gotip work sync.

What did you expect to see?

gopls/go.mod and gopls/go.sum are updated to reflect dependency changes (maybe?)

OTOH, I don't know what's the intended behavior.
The development was done using an uncommitted golang.org/x/tools module version.
If the code in golang.org/x/tools/gopls module depends on uncommitted changes in
golang.org/x/tools module, it's not possible to create a working go.mod /go.sum until
the change for golang.org/x/tools module is first committed & released.

It's likely I misunderstood the purpose of gotip work sync.

What did you see instead?

Changes like this : https://go-review.googlesource.com/c/tools/+/370194/1
See the go.sum file missing all entries.

@matloob

@matloob matloob self-assigned this Dec 8, 2021
@seankhliao seankhliao added the NeedsFix The path to resolution is known, but the work has not been done. label Dec 8, 2021
@bcmills bcmills added modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. okay-after-beta1 Used by release team to mark a release-blocker issue as okay to resolve either before or after beta1 release-blocker labels Dec 10, 2021
@bcmills bcmills added this to the Go1.18 milestone Dec 10, 2021
@gopherbot gopherbot removed the NeedsFix The path to resolution is known, but the work has not been done. label Dec 10, 2021
@cherrymui cherrymui removed the okay-after-beta1 Used by release team to mark a release-blocker issue as okay to resolve either before or after beta1 label Dec 14, 2021
@cherrymui
Copy link
Member

Any update on this? Thanks. (checking in as this is a release blocker)

@gopherbot
Copy link

Change https://golang.org/cl/376655 mentions this issue: cmd/go: reset modfetch state between modules in go work sync

jproberts pushed a commit to jproberts/go that referenced this issue Jun 21, 2022
go work sync resets the state in the modload package before each
iteration where it updates the workspace modules' go.mod files. But
before this change it wasn't resetting the global state in the modfetch
package. This is necessary because the modfetch package keeps track of
the sums that will be written to go.sum. Further, the fetch caches
will update information about which modules are used when fetching
packages, and so those caches need to be cleared between each workspace
module.

Thanks bcmills for helping me debug!

Fixes golang#50038

Change-Id: I5679c18a80feb7c5194c4a5f7e7129c7d198ef7b
Reviewed-on: https://go-review.googlesource.com/c/go/+/376655
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
@rsc rsc unassigned matloob Jun 22, 2022
@golang golang locked and limited conversation to collaborators Jun 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Projects
None yet
Development

No branches or pull requests

6 participants