aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/modload/list.go
diff options
context:
space:
mode:
authorJay Conrod <jayconrod@google.com>2020-04-15 13:56:09 -0400
committerJay Conrod <jayconrod@google.com>2020-08-26 21:12:37 +0000
commitc769f034d796769ad10fc03fe6866b36039d1a09 (patch)
tree282c9cdb6aac0f7fd13bfc937df66d248a6f9a04 /src/cmd/go/internal/modload/list.go
parentdb821b54d1a8dffa85a9a3cf599f83a19184f020 (diff)
downloadgo-c769f034d796769ad10fc03fe6866b36039d1a09.tar.gz
go-c769f034d796769ad10fc03fe6866b36039d1a09.zip
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>
Diffstat (limited to 'src/cmd/go/internal/modload/list.go')
-rw-r--r--src/cmd/go/internal/modload/list.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cmd/go/internal/modload/list.go b/src/cmd/go/internal/modload/list.go
index 2f549540a6..a3461eea26 100644
--- a/src/cmd/go/internal/modload/list.go
+++ b/src/cmd/go/internal/modload/list.go
@@ -85,7 +85,8 @@ func listModules(ctx context.Context, args []string, listVersions bool) []*modin
allowed := CheckAllowed
if IsRevisionQuery(vers) {
- // Allow excluded versions if the user asked for a specific revision.
+ // Allow excluded and retracted versions if the user asked for a
+ // specific revision.
allowed = nil
}
info, err := Query(ctx, path, vers, current, allowed)