-
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: "go mod download" doesn't record checksums for replacements in workspace mode #51946
Comments
This may be a bad interaction with #44435. |
I attempted to diagnose this issue, and the diagnostic steps revealed a livelock in the module graph computation (filed as #53874). Once that is resolved we should revisit this issue promptly. |
With CL 417594 (the fix for #53874) patched in, I see the following:
And {
"Path": "github.com/samber/lo",
"Version": "v1.3.2-0.20220305174447-4edabde35217",
"Info": "/tmp/tmp.gAss6FA3Dd/.gopath/pkg/mod/cache/download/github.com/samber/lo/@v/v1.3.2-0.20220305174447-4edabde35217.info",
"GoMod": "/tmp/tmp.gAss6FA3Dd/.gopath/pkg/mod/cache/download/github.com/samber/lo/@v/v1.3.2-0.20220305174447-4edabde35217.mod",
"Zip": "/tmp/tmp.gAss6FA3Dd/.gopath/pkg/mod/cache/download/github.com/samber/lo/@v/v1.3.2-0.20220305174447-4edabde35217.zip",
"Dir": "/tmp/tmp.gAss6FA3Dd/.gopath/pkg/mod/github.com/samber/lo@v1.3.2-0.20220305174447-4edabde35217",
"Sum": "h1:6ALV695vge95bcdzsU1NfpRBWzo1/PGW7k5COD63xag=",
"GoModSum": "h1:2I7tgIv8Q1SG2xEIkRq0F2i2zgxVpnyPOP0d3Gj2r+A="
} @h31, could you confirm whether that patch is a complete fix for your issue? |
Hmm. With the patch applied, the That seems off: it seems to me that the
|
The missing checksums are closely related to this TODO: If However, that does not hold in workspace mode: one module in the workspace can upgrade another's dependencies, and if the dependencies include nested modules, the act of upgrading can move packages from one module into or out of another module whose path is a shared prefix. Moreover, if So in workspace mode, |
Change https://go.dev/cl/417654 mentions this issue: |
Found the fix and it's tiny. This might make 1.19 after all. |
@h31, this should be fixed at HEAD and in the final In the meantime, you should be able to work around this issue by using
|
…a workspace Within a single module we expect all needed checksums to have already been recorded by a previous call to 'go get' or 'go mod tidy' in that module. However, when we combine multiple modules in a workspace, they may upgrade each other's dependencies, so a given module might be upgraded above the highest version recorded in the individual go.sum files for the workspace modules. Since the checksums might not be present in individual go.sum files, record them in go.work.sum. Fixes golang#51946. Change-Id: Icb4ea874b9e5c5b1950d42650974a24b5d6543d4 Reviewed-on: https://go-review.googlesource.com/c/go/+/417654 Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com>
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?
git clone https://github.com/sergunya/my_workspace; cd my_workspace/
rm go.work.sum
go clean -modcache
cd cmd/my_app/
go mod download
go list -m -json all
What did you expect to see?
github.com/samber/lo@v1.3.2-0.20220305174447-4edabde35217
necessary to buildmy_app
module is downloaded and has a "Dir" property ingo list
output.What did you see instead?
There's no "Dir" property.
I tried to debug Go source code and found that
checksumOk("")
in src/cmd/go/internal/modload/build.go:275 returns false forgithub.com/samber/lo
. Buildingmy_app
usinggo build
adds the necessary checksum togo.work.sum
and the issue disappears. It doesn't help to rungo mod tidy
orgo work sync
beforego mod download
.The text was updated successfully, but these errors were encountered: