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/internal/modfetch: always check for a go.mod file when fetching from version control
If the module path declared in the go.mod file does not match the path
we are trying to resolve, a build using that module is doomed to fail.
Since we know that the module path does not match in the underlying
repo, we also know that the requested module does not exist at the
requested version.
Therefore, we should reject that version in Stat with a “not exist”
error — sooner rather than later — so that modload.Query will continue
to check other candidate paths (for example, with a major-version
suffix added or removed).
Fixes#33099
Change-Id: I43c980f78ed75fa6ace90f237cc3aad46c22d83a
Reviewed-on: https://go-review.googlesource.com/c/go/+/186237
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
@@ -631,15 +631,30 @@ var latestTests = []struct {
631
631
err: "no commits",
632
632
},
633
633
{
634
-
vcs: "git",
635
-
path: "github.com/rsc/vgotest1",
636
-
version: "v0.0.0-20180219223237-a08abb797a67",
634
+
vcs: "git",
635
+
path: "github.com/rsc/vgotest1",
636
+
err: `github.com/rsc/vgotest1@v0.0.0-20180219223237-a08abb797a67: invalid version: go.mod has post-v0 module path "github.com/vgotest1/v2" at revision a08abb797a67`,
637
+
},
638
+
{
639
+
vcs: "git",
640
+
path: "github.com/rsc/vgotest1/v2",
641
+
err: `github.com/rsc/vgotest1/v2@v2.0.0-20180219223237-a08abb797a67: invalid version: github.com/rsc/vgotest1/go.mod and .../v2/go.mod both have .../v2 module paths at revision a08abb797a67`,
637
642
},
638
643
{
639
644
vcs: "git",
640
645
path: "github.com/rsc/vgotest1/subdir",
641
646
err: "github.com/rsc/vgotest1/subdir@v0.0.0-20180219223237-a08abb797a67: invalid version: missing github.com/rsc/vgotest1/subdir/go.mod at revision a08abb797a67",
0 commit comments