]> Cypherpunks repositories - gostls13.git/commit
cmd/go/internal/modload: don't query when fixing canonical versions
authorJay Conrod <jayconrod@google.com>
Thu, 25 Feb 2021 23:38:43 +0000 (18:38 -0500)
committerJay Conrod <jayconrod@google.com>
Mon, 1 Mar 2021 14:46:14 +0000 (14:46 +0000)
commit5fafc0bbd4819578e58e5b9163981b0074ab0b01
tree83dbf29eea13907907ffa2836168342487aa2858
parent2a8df4488ee893353b1200794bde758e9726e7c7
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 #44494

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>
src/cmd/go/internal/modload/init.go
src/cmd/go/testdata/script/mod_retract_fix_version.txt