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: rethink 'go get' skipping test-only packages #20760

Closed
rsc opened this issue Jun 22, 2017 · 3 comments
Closed

cmd/go: rethink 'go get' skipping test-only packages #20760

rsc opened this issue Jun 22, 2017 · 3 comments
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@rsc
Copy link
Contributor

rsc commented Jun 22, 2017

Issue #15093 complained that go get x.com/y/... can match (via the wildcard) a directory x.com/y/z that only has tests in it, and then the 'go get' fails, because it cannot run 'go install x.com/y/z'. A fix was made for that CL, which silences the reporting of the "no Go files" error in x.com/y/z during 'go get', provided there are test files in that directory.

That fixes the problem reported, but it introduces other problems:

  1. It makes go get behave differently from go install, even though get is defined as download + install.
  2. go get x.com/y/z probably should report the error, while 'go get x.com/y/...' might reasonably omit it.
  3. If x.com/y/p incorrectly imports x.com/y/z, the error building z is not reported, and p silently fails to build, and the overall go get exits 0 as if everything was OK.
  4. The fix was considered only TestGoFiles and not XTestGoFiles.

A pending CL of mine will address 3 and 4; we should reconsider 1 and 2 at some later point.

@rsc rsc added this to the Go1.10 milestone Jun 22, 2017
@rsc rsc added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Jun 22, 2017
@gopherbot
Copy link

CL https://golang.org/cl/46427 mentions this issue.

gopherbot pushed a commit that referenced this issue Jun 23, 2017
Maybe there are no Go files at all.
Maybe they are all excluded by build constraints.
Maybe there are only test Go files.
Be specific.

Fixes #17008.
Fixes parts of #20760.

Change-Id: If6ac82ba0ed437772e76e06763263747d3bc4f65
Reviewed-on: https://go-review.googlesource.com/46427
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
@jessfraz
Copy link
Contributor

sorry i made the fix for the original "bug" let me know if I can help

@rsc rsc modified the milestones: Go1.10, Go1.11 Dec 1, 2017
@gopherbot
Copy link

Change https://golang.org/cl/121196 mentions this issue: cmd/go: ignore wildcard-matched test-only packages in go build

@golang golang locked and limited conversation to collaborators Jun 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

3 participants