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

proposal: cmd/go: add "go test -compile" option to just compile tests, not link or run them #46712

Closed
natefinch opened this issue Jun 11, 2021 · 4 comments

Comments

@natefinch
Copy link
Contributor

Propose we add a -compile flag to go test that just compiles the tests without linking or running them.

Right now we have to do something like go test -run=xxx, which is not very discoverable, and takes the time to link and run the test executables.

For larger projects this can be a big time savings, as well as being more discoverable.

I use the -run=xxx thing all the time to find places where tests won't compile from changes in code.

@gopherbot gopherbot added this to the Proposal milestone Jun 11, 2021
@ianlancetaylor
Copy link
Contributor

Well, there is go test -c -o /dev/null. That does the link step, but it doesn't run anything.

@ianlancetaylor ianlancetaylor changed the title Proposal: cmd/go test -compile proposal: cmd/go: add "go test -compile" option to just compile tests, not link or run them Jun 11, 2021
@ianlancetaylor ianlancetaylor added this to Incoming in Proposals (old) Jun 11, 2021
@natefinch
Copy link
Contributor Author

You can't use -c with multiple packages, though, and that's where a -compile would really help.

$ go test -c -o /dev/null ./...
cannot use -c flag with multiple packages

@ALTree
Copy link
Member

ALTree commented Jun 12, 2021

Dup of #15513, closing here in favour of the older thread.

@ALTree ALTree closed this as completed Jun 12, 2021
@rsc rsc moved this from Incoming to Declined in Proposals (old) Nov 3, 2021
@rsc
Copy link
Contributor

rsc commented Nov 3, 2021

This proposal is a duplicate of a previously discussed proposal, as noted above,
and there is no significant new information to justify reopening the discussion.
The issue has therefore been declined as a duplicate.
— rsc for the proposal review group

@golang golang locked and limited conversation to collaborators Nov 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Development

No branches or pull requests

5 participants