Commit df6aedb6 authored by Russ Cox's avatar Russ Cox

cmd/go: fix list -compiled of package with only tests

Fixes #27097.

Change-Id: I6aa48a1c58a21fd320b0e9dcd1f86c90172f0182
Reviewed-on: https://go-review.googlesource.com/130139
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent c652a1b9
......@@ -510,7 +510,9 @@ func runList(cmd *base.Command, args []string) {
a := &work.Action{}
// TODO: Use pkgsFilter?
for _, p := range pkgs {
a.Deps = append(a.Deps, b.AutoAction(work.ModeInstall, work.ModeInstall, p))
if len(p.GoFiles)+len(p.CgoFiles) > 0 {
a.Deps = append(a.Deps, b.AutoAction(work.ModeInstall, work.ModeInstall, p))
}
}
b.Do(a)
}
......
env GO111MODULE=on
# go list -compiled -test must handle test-only packages
# golang.org/issue/27097.
go list -compiled -test
stdout '^m$'
stdout '^m\.test$'
stdout '^m \[m\.test\]$'
-- go.mod --
module m
-- x_test.go --
package x
import "testing"
func Test(t *testing.T) {}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment