]> Cypherpunks repositories - gostls13.git/commit
cmd/go/internal/modload: support go.mod retract directive
authorJay Conrod <jayconrod@google.com>
Wed, 15 Apr 2020 17:56:09 +0000 (13:56 -0400)
committerJay Conrod <jayconrod@google.com>
Wed, 26 Aug 2020 21:12:37 +0000 (21:12 +0000)
commitc769f034d796769ad10fc03fe6866b36039d1a09
tree282c9cdb6aac0f7fd13bfc937df66d248a6f9a04
parentdb821b54d1a8dffa85a9a3cf599f83a19184f020
cmd/go/internal/modload: support go.mod retract directive

The go command now recognizes 'retract' directives in go.mod. A
retract directive may be used by a module author to indicate a
version should not be used. The go command will not automatically
upgrade to a retracted version. Retracted versions will not be
considered when resolving version queries like "latest" that don't
refer to a specific version.

Internally, when the go command resolves a version query, it will find
the highest release version (or pre-release if no release is
available), then it will load retractions from the go.mod file for
that version. Comments on retractions are treated as a rationale and
may appear in error messages. Retractions are only loaded when a query
is resolved, so this should have no impact on performance for most
builds, except when go.mod is incomplete.

For #24031

Change-Id: I17d643b9e03a3445676dbf1a5a351090c6ff6914
Reviewed-on: https://go-review.googlesource.com/c/go/+/228380
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
15 files changed:
src/cmd/go/alldocs.go
src/cmd/go/internal/modinfo/info.go
src/cmd/go/internal/modload/help.go
src/cmd/go/internal/modload/list.go
src/cmd/go/internal/modload/modfile.go
src/cmd/go/testdata/mod/example.com_retract_self_prev_v1.0.0-bad.txt [new file with mode: 0644]
src/cmd/go/testdata/mod/example.com_retract_self_prev_v1.1.0.txt [new file with mode: 0644]
src/cmd/go/testdata/mod/example.com_retract_self_prev_v1.9.0.txt [new file with mode: 0644]
src/cmd/go/testdata/mod/example.com_retract_v1.0.0-bad.txt [new file with mode: 0644]
src/cmd/go/testdata/mod/example.com_retract_v1.0.0-good.txt [new file with mode: 0644]
src/cmd/go/testdata/mod/example.com_retract_v1.0.0-unused.txt [new file with mode: 0644]
src/cmd/go/testdata/mod/example.com_retract_v1.1.0.txt [new file with mode: 0644]
src/cmd/go/testdata/script/mod_download.txt
src/cmd/go/testdata/script/mod_retract.txt [new file with mode: 0644]
src/cmd/go/testdata/script/mod_sumdb_golang.txt