Skip to content

cmd/go: test coverpkg=all ./... with test only packages will fail to build #27333

Closed
@AlexRouSg

Description

@AlexRouSg

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

1.11

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

linux amd64

What did you do?

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.

Ran go test -coverpkg=all ./... with the following folder structure:

├── foo.go
├── foo_test.go
└── tests
    └── tests_test.go

Content of files is irrelevant.
Apparently go test -cover ./... works, so it's specific to -coverpkg
Also deleting foo_test.go works

What did you expect to see?

ok      _/<HOME>/go/src/foo   0.001s  coverage: 0.0% of statements [no tests to run]
ok      _/<HOME>/go/src/foo/tests     0.004s  coverage: 0.0% of statements [no tests to run]

What did you see instead?

go build _/<HOME>/go/src/foo/tests: no non-test Go files in go/src/foo/tests
FAIL    _/<HOME>/go/src/foo [build failed]
ok      _/<HOME>/go/src/foo/tests     0.001s  coverage: 0.0% of statements in all [no tests to run]

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions