Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: test coverpkg=./... not ignoring folders with test only files #23454

Closed
AlexRouSg opened this issue Jan 16, 2018 · 5 comments
Closed
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@AlexRouSg
Copy link
Contributor

Please answer these questions before submitting your issue. Thanks!

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

go1.9.2 linux/amd64

Does this issue reproduce with the latest release?

yes

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

not revelent

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.

go test -coverpkg ./... mypkg/anotherpkg
Where mypkg contains folders containing test only files

What did you expect to see?

PASS
coverage: 100% of statements...

What did you see instead?

go build mypkg/examples: no non-test Go files in ~/go/src/mypkg/examples
FAIL mypkg/anotherpkg [build failed]

@AlexRouSg AlexRouSg changed the title cmd/go: coverpkg=./... not ignoreing folders with test only files cmd/go: test coverpkg=./... not ignoreing folders with test only files Jan 16, 2018
@0xmohit
Copy link
Contributor

0xmohit commented Jan 16, 2018

Appears to be the same issue as reported in #23395.

@AlexRouSg
Copy link
Contributor Author

AlexRouSg commented Jan 16, 2018

Saw that, but wasn't sure if it's the same issue as that concerns go vet and this concerns go test -coverpkg

@odeke-em odeke-em changed the title cmd/go: test coverpkg=./... not ignoreing folders with test only files cmd/go: test coverpkg=./... not ignoring folders with test only files Jan 16, 2018
@mvdan
Copy link
Member

mvdan commented Jan 16, 2018

Can't be the same issue, as that was a regression from 1.9, and this one is not.

@AlexRouSg
Copy link
Contributor Author

I've since found a simple workaround in case anyone was wondering.
Simply make an empty .go file with the package declaration.
And that's enough to get coverpkg to continue on.

I would be fine with that for the short term, but this will get pretty annoying when you have a ton of test only folders.

@titanous titanous added the NeedsFix The path to resolution is known, but the work has not been done. label Jan 16, 2018
@titanous titanous added this to the Go1.11 milestone Jan 16, 2018
@rsc
Copy link
Contributor

rsc commented Jun 27, 2018

Fixed in Go 1.10 because -coverpkg now takes a pattern filtering the list of packages already going into the test binary, not a pattern generating a list of packages.

@rsc rsc closed this as completed Jun 27, 2018
@golang golang locked and limited conversation to collaborators Jun 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

6 participants