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: do not compile test package if non-test can't build #44624

Open
rsc opened this issue Feb 26, 2021 · 3 comments
Open

cmd/go: do not compile test package if non-test can't build #44624

rsc opened this issue Feb 26, 2021 · 3 comments
Labels
Milestone

Comments

@rsc
Copy link
Contributor

@rsc rsc commented Feb 26, 2021

I keep getting output like this from go test:

% go test ./...
?   	golang.org/x/website	[no test files]
# golang.org/x/website/internal/godoc
internal/godoc/examplefuncs.go:24:14: page.Value undefined (type *Page has no field or method Value)
# golang.org/x/website/internal/godoc [golang.org/x/website/internal/godoc.test]
internal/godoc/examplefuncs.go:24:14: page.Value undefined (type *Page has no field or method Value)

It's just noise to print the same errors twice.

An easy way to fix this would be to make the test version of the package have the non-test version as a (not strictly necessary) dependency. Then if the build of the non-test version fails, the build of test version won't be attempted.

/cc @jayconrod @matloob

@rsc rsc added the NeedsFix label Feb 26, 2021
@rsc rsc added this to the Go1.17 milestone Feb 26, 2021
@robpike
Copy link
Contributor

@robpike robpike commented Feb 26, 2021

I can't find the previous issue but I brought this up some time ago. If you can find it, what was the resolution? Or did it come back somehow?

@ALTree
Copy link
Member

@ALTree ALTree commented Feb 26, 2021

@robpike This one? f0fef32

@robpike
Copy link
Contributor

@robpike robpike commented Feb 26, 2021

Yes, which points to this one: #5679

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants