-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Open
Labels
GoCommandcmd/gocmd/goNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Description
What version of Go are you using (go version)?
$ go version go version go1.20.5 linux/amd64
(Also reproduced at HEAD.)
Does this issue reproduce with the latest release?
Yes.
What did you do?
$ cd $GOROOT/src
$ go list -deps -test -f '{{.ImportPath}} {{.DepOnly}} {{.Match}}' ./... | grep 'context\.test'
context [context.test] false [./...]
runtime/trace [context.test] true [./...]
testing [context.test] true [./...]
os/exec [context.test] true [./...]
internal/fuzz [context.test] true [./...]
os/signal [context.test] true [./...]
runtime/pprof [context.test] true [./...]
testing/internal/testdeps [context.test] true [./...]
net [context.test] true [./...]
context_test [context.test] false []
context.test false []
What did you expect to see?
The documentation for DepOnly and Match is:
Match []string // command-line patterns matching this package
DepOnly bool // package is only a dependency, not explicitly listed
It's not clear whether packages built on behalf of tests "match" the pattern, but the output seems clearly inconsistent in some ways:
- Given that
context.testhas DepOnly == false, that implies cmd/go does think ofcontext.testas "explicitly listed" by./.... It also clearly thinks of, say,netas "explicitly listed" by./.... So it seems odd thatnet [context.test](and several others) have DepOnly == true, indicating that they're not "explicitly listed". - Based on the documentation, I would expect that, if DepOnly == true, then it's "not explicitly listed", so Match should be empty because it didn't match any patterns. And if DepOnly == false, then it is "explicitly listed", and Match should list at least one pattern. For example,
context.testis "explicitly listed", yet cmd/go can't tell me what pattern it matched.
What did you see instead?
DepOnly is true for some of these and false for others in ways I can't rationalize.
For some packages, DepOnly == true, but a Match pattern is also listed.
For some packages, DepOnly == false, but a Match pattern is listed.
Metadata
Metadata
Assignees
Labels
GoCommandcmd/gocmd/goNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.