]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.16] cmd/go/internal/modload: don't query when fixing canonical...
authorJay Conrod <jayconrod@google.com>
Thu, 25 Feb 2021 23:38:43 +0000 (18:38 -0500)
committerDmitri Shuralyov <dmitshur@golang.org>
Wed, 3 Mar 2021 17:58:41 +0000 (17:58 +0000)
commita9ba734e4df7d4006b18dfc6f8f4272da828c6ef
tree3beeefe78ae3d96d3676205e30dfdf066cf9fc8d
parent047ca22916333a850bfdea1db4920120911e5cb0
[release-branch.go1.16] cmd/go/internal/modload: don't query when fixing canonical versions

If a canonical version is passed to fixVersion when loading the main
go.mod and that version don't match the module path's major version
suffix, don't call Query.

Query doesn't return a useful error in this case when the path is
malformed, for example, when it doens't have a dot in the first path
element. It's better to report the major version mismatch error.

Fixes #44496

Change-Id: I97b1f64aee894fa0db6fb637aa03a51357ee782c
Reviewed-on: https://go-review.googlesource.com/c/go/+/296590
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
(cherry picked from commit 5fafc0bbd4819578e58e5b9163981b0074ab0b01)
Reviewed-on: https://go-review.googlesource.com/c/go/+/297989
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
src/cmd/go/internal/modload/init.go
src/cmd/go/testdata/script/mod_retract_fix_version.txt