]> Cypherpunks repositories - gostls13.git/commit
cmd/go/internal/modfetch: always check for a go.mod file when fetching from version...
authorBryan C. Mills <bcmills@google.com>
Mon, 15 Jul 2019 18:06:58 +0000 (14:06 -0400)
committerBryan C. Mills <bcmills@google.com>
Mon, 15 Jul 2019 21:51:12 +0000 (21:51 +0000)
commit24a6ca09d0151f2dc6a524217b8523abd33403bb
tree84be14588b2701fc2a11da88f642d0bb4ba6c72a
parent20e4540e9084528a1b36978882596daa7d8d8800
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>
src/cmd/go/internal/modfetch/coderepo.go
src/cmd/go/internal/modfetch/coderepo_test.go
src/cmd/go/internal/modload/query_test.go
src/cmd/go/testdata/script/mod_list_direct.txt [new file with mode: 0644]