[go] cmd/go: loosen go work sync version requirements

0 views
Skip to first unread message

Michael Matloob (Gerrit)

unread,
Apr 29, 2026, 2:17:37 PM (23 hours ago) Apr 29
to goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, golang...@luci-project-accounts.iam.gserviceaccount.com, Dmitri Shuralyov, Dmitri Shuralyov, Michael Matloob, Ian Alexander, golang-co...@googlegroups.com

Michael Matloob submitted the change with unreviewed changes

Unreviewed changes

4 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:

```
The name of the file: src/cmd/go/internal/workcmd/sync.go
Insertions: 1, Deletions: 1.

The diff is too large to show. Please review the diff.
```

Change information

Commit message:
cmd/go: loosen go work sync version requirements

In go work sync, we may resolve lower versions of modules for the
workspace than what we would in an individual module because replace
directives in the workspace can hide requirements that would bump
versions up. If we try to force those versions for each module we'll run
into a conflict. Instead, make the new requirements additive so it only
bumps the versions up.

We still have the issue that we originally resolve the modules using the
workspace's replaces but later apply the requirements using the modules,
but that's unavoidable so we just have to work around it. The important
thing is that we now don't throw away the error and silently avoid
changing the go.mod file. Additionally, in the case there are errors,
we'll check for them ahead of time and only write out the synced go.mod
files if there were no errors.

Fixes #65363
Change-Id: I25bd98719eb5de0530d50eba3ccf4b2a6a6a6964
Reviewed-by: Dmitri Shuralyov <dmit...@golang.org>
Reviewed-by: Michael Matloob <mat...@google.com>
TryBot-Bypass: Michael Matloob <mat...@golang.org>
Reviewed-by: Dmitri Shuralyov <dmit...@google.com>
Files:
  • M src/cmd/go/internal/workcmd/sync.go
  • A src/cmd/go/testdata/mod/example.com_syncreplace_v1.0.0.txt
  • A src/cmd/go/testdata/mod/example.com_syncreplace_v1.1.0.txt
  • A src/cmd/go/testdata/script/work_sync_replace.txt
Change size: M
Delta: 4 files changed, 115 insertions(+), 17 deletions(-)
Branch: refs/heads/master
Submit Requirements:
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I25bd98719eb5de0530d50eba3ccf4b2a6a6a6964
Gerrit-Change-Number: 762602
Gerrit-PatchSet: 7
Gerrit-Owner: Michael Matloob <mat...@golang.org>
Gerrit-Reviewer: Dmitri Shuralyov <dmit...@golang.org>
Gerrit-Reviewer: Dmitri Shuralyov <dmit...@google.com>
Gerrit-Reviewer: Ian Alexander <ji...@google.com>
Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
Gerrit-Reviewer: Michael Matloob <mat...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages