You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cmd/go: save sums for zips needed to diagnose ambiguous imports
Previously, we would retain entries in go.sum for .mod files in the
module graph (reachable from the main module) and for .zip files
of modules providing packages.
This isn't quite enough: when we load a package, we need the content
of each module in the build list that *could* provide the package
(that is, each module whose path is a prefix of the package's path) so
we can diagnose ambiguous imports.
For #33008
Change-Id: I0b4d9d68c1f4ca382f0983a3a7e537764f35c3aa
Reviewed-on: https://go-review.googlesource.com/c/go/+/262781
Reviewed-by: Michael Matloob <[email protected]>
Reviewed-by: Bryan C. Mills <[email protected]>
Trust: Jay Conrod <[email protected]>
# If two modules could provide a package, and we're missing a sum for one,
14
+
# we should see a missing sum error, even if we have a sum for a module that
15
+
# provides the package.
16
+
cp go.sum.a-only go.sum
17
+
! go list example.com/ambiguous/a/b
18
+
stderr '^missing go.sum entry needed to verify package example.com/ambiguous/a/b is provided by exactly one module$'
19
+
! go list -deps .
20
+
stderr '^use.go:3:8: missing go.sum entry needed to verify package example.com/ambiguous/a/b is provided by exactly one module; try ''go mod tidy'' to add it$'
21
+
22
+
cp go.sum.b-only go.sum
23
+
! go list example.com/ambiguous/a/b
24
+
stderr '^missing go.sum entry for module providing package example.com/ambiguous/a/b$'
25
+
! go list -deps .
26
+
stderr '^use.go:3:8: missing go.sum entry for module providing package example.com/ambiguous/a/b; try ''go mod tidy'' to add it$'
0 commit comments