diff options
author | Jay Conrod <jayconrod@google.com> | 2021-03-31 14:47:59 -0400 |
---|---|---|
committer | Jay Conrod <jayconrod@google.com> | 2021-04-09 18:20:48 +0000 |
commit | 814c5ff13810e800aeb67fd0371e21984d4d2c64 (patch) | |
tree | b11301ba1ae9dacbae011f3e0e1d2fb024025ded /src/cmd/go/internal/modload/buildlist.go | |
parent | 952187af12485eb665ae122f6d0bdb36e4a11ed7 (diff) | |
download | go-814c5ff13810e800aeb67fd0371e21984d4d2c64.tar.gz go-814c5ff13810e800aeb67fd0371e21984d4d2c64.zip |
cmd/go: support module deprecation
A module is deprecated if its author adds a comment containing a
paragraph starting with "Deprecated:" to its go.mod file. The comment
must appear immediately before the "module" directive or as a suffix
on the same line. The deprecation message runs from just after
"Deprecated:" to the end of the paragraph. This is implemented in
CL 301089.
'go list -m -u' loads deprecation messages from the latest version of
each module, not considering retractions (i.e., deprecations and
retractions are loaded from the same version). By default, deprecated
modules are printed with a "(deprecated)" suffix. The full deprecation
message is available in the -f and -json output.
'go get' prints deprecation warnings for modules named on the command
line. It also prints warnings for modules needed to build packages
named on the command line if those modules are direct dependencies of
the main module.
For #40357
Change-Id: Id81fb2b24710681b025becd6cd74f746f4378e78
Reviewed-on: https://go-review.googlesource.com/c/go/+/306334
Trust: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Diffstat (limited to 'src/cmd/go/internal/modload/buildlist.go')
-rw-r--r-- | src/cmd/go/internal/modload/buildlist.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/cmd/go/internal/modload/buildlist.go b/src/cmd/go/internal/modload/buildlist.go index 3fbe3c6700..a1ac7b22b7 100644 --- a/src/cmd/go/internal/modload/buildlist.go +++ b/src/cmd/go/internal/modload/buildlist.go @@ -191,6 +191,12 @@ func (rs *Requirements) Graph(ctx context.Context) (*ModuleGraph, error) { return cached.mg, cached.err } +// IsDirect returns whether the given module provides a package directly +// imported by a package or test in the main module. +func (rs *Requirements) IsDirect(path string) bool { + return rs.direct[path] +} + // A ModuleGraph represents the complete graph of module dependencies // of a main module. // |