-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: -coverprofile with relative path uses wrong file name #22430
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
My guess is that this is a bug related to using something other than an import path with |
@ianlancetaylor What do you mean? Do you know of any workarounds? |
I think I meant that in the command line |
I tried this, however the cover tool seems to prefix the coverage data with things like the CWD or
If you look at the last line
|
@TheD0ctor did you ever find a workaround for this? Still seeing this in 1.9.5 |
I see this too, here's my workaround (running inside my repo directory):
|
FWIW this is still in this state as of go1.11 $ go test -v -coverprofile=coverage.out -covermode=count ./... For some projects I've had this in a githook: note: the sed recipe acopy/paste problem... fixed, I hope :) |
I think this no longer reproduces. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.9.1 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?macOS Sierra 10.12.6
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.
I am trying to generate coverage reports for a simple application but am unable to due to the wrong path being generated in the -coverprofile output
I am having the issue outlined here: Masterminds/glide#43 . I've recreated the problem with a simple example modeled after the skeleton of my application. I am on macOS Sierra, go1.9 is installed via goenv.
Directory structure
Dummy.go
SuperDummy.go
TestSuperDummy_test.go
main.go
From the
src/
directory I rango test ./lib/foo -coverprofile=cover.out
which yielded:Running
go tool cover -html=cover.out
yields the error :The text was updated successfully, but these errors were encountered: