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: -outputdir being ignored by go test #22804

Closed
lawrencewoodman opened this issue Nov 19, 2017 · 4 comments
Closed

cmd/go: -outputdir being ignored by go test #22804

lawrencewoodman opened this issue Nov 19, 2017 · 4 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Milestone

Comments

@lawrencewoodman
Copy link

Please answer these questions before submitting your issue. Thanks!

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

go version devel +e4a3043d1d Sun Nov 19 05:06:59 2017 +0000 linux/amd64

Does this issue reproduce with the latest release?

No, it works fine with v1.9.2

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

amd64

What did you do?

From the root of a package I wanted to test I ran:
go test -covermode=count -coverprofile=profile.coverprofile -outputdir=/tmp/coverprofiles

What did you expect to see?

I expected to find the file profile.coverprofile in /tmp/coverprofiles.

What did you see instead?

The directory /tmp/coverprofiles was empty and instead the file profile.coverprofile was in the current directory.

@odeke-em odeke-em changed the title -outputdir being ignored by go test cmd/go: -outputdir being ignored by go test Nov 19, 2017
@odeke-em
Copy link
Member

/cc @rsc

@odeke-em
Copy link
Member

I can confirm that CL https://go-review.googlesource.com/76875
and commit 283558e is the cause of this regression.

In particular the lines
283558e#diff-acaf53a9cd478507ebbcf85037940b4dR1231
or rather the merging in

if strings.HasPrefix(arg, "-test.coverprofile=") {
args[i] = "-test.coverprofile=" + a.Objdir + "_cover_.out"
}
that breaks it.

@odeke-em odeke-em added the NeedsFix The path to resolution is known, but the work has not been done. label Nov 20, 2017
@odeke-em odeke-em added this to the Go1.10 milestone Nov 20, 2017
hiendv added a commit to hiendv/gate that referenced this issue Nov 20, 2017
@rsc
Copy link
Contributor

rsc commented Dec 1, 2017

What a strange flag.

@gopherbot
Copy link

Change https://golang.org/cl/81455 mentions this issue: cmd/go: fix -outputdir -coverprofile interaction

@golang golang locked and limited conversation to collaborators Dec 1, 2018
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. release-blocker
Projects
None yet
Development

No branches or pull requests

5 participants