-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: go run -cover #16537
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
Comments
I'm not sure how "go run" would communicate to the subprocess that it should collect coverage. "go test" does so by passing a command-line flag, no? |
This would be really nice. Here's one example of a test that builds a binary, then runs it to test the main function: app_test.go (and the associated testutil) It would be great to have that considered for code/test coverage. |
Need to think more but I don't really understand what this would mean. |
Not quite. Passing |
I uploaded a fix for discussion here: https://go-review.googlesource.com/42096. |
CL https://golang.org/cl/42096 mentions this issue. |
I tend to agree that we want to keep go run limited in its scope. But there is no 'go build -cover' so at the very least that would need to happen first. If that did happen, then go run -cover might fall out for free. That said, I'm not sure go build -cover should happen. Coverage is fairly tied to testing. If you did -cover outside of tests you'd need to recreate the testing package support that exports the coverage info. |
Uh. Then maybe testing support for coverage info should be extracted to some package, /x/ maybe? Right now it's private, and existing solution is too fragile. |
@AlekSi Whatever you suggest, that should probably be in a different issue. We are still unlikely to add |
Currently
-cover
is only supported in unit tests. Running service with-cover
and then running functional/system/API tests against it will give information about what parts are tested and what are not.It's possible to (ab)use
go test -cover -c
to get desirable result, but there have to be a better way.The text was updated successfully, but these errors were encountered: