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: clearer error for 'go install' with only x_test.go files #7915

Closed
fudanchii opened this issue May 1, 2014 · 4 comments
Closed

cmd/go: clearer error for 'go install' with only x_test.go files #7915

fudanchii opened this issue May 1, 2014 · 4 comments
Milestone

Comments

@fudanchii
Copy link

What does 'go version' print?
go version devel +c19d7fd53785 Wed Apr 30 13:03:38 2014 -0400 linux/amd64
also on go1.3-beta

What steps reproduce the problem?
If possible, include a link to a program on play.golang.org.
(test sandbox: github.com/fudanchii/A)

$ go get github.com/fudanchii/A
$ cd A
$ go test -v ./c
=== RUN TestBbb
BBB
Ccc
--- PASS: TestBbb (0.00 seconds)
PASS
ok      github.com/fudanchii/A/c        0.002s
adie@eenvijf:A $ go get ./...
go install github.com/fudanchii/A/c: open
/tmp/go-build504804933/github.com/fudanchii/A/c.a: no such file or directory


What happened?
go install error as the following:
go install github.com/fudanchii/A/c: open
/tmp/go-build504804933/github.com/fudanchii/A/c.a: no such file or directory


What should have happened instead?
$ go get github.com/fudanchii/A
$ cd A
$ go get -t -v ./...
$

no error on `go version go1.2.1 linux/386`

Please provide any additional information below.
-
@ianlancetaylor
Copy link
Contributor

Comment 1:

Labels changed: added repo-main, release-go1.3.

@rsc
Copy link
Contributor

rsc commented May 9, 2014

Comment 2:

The root cause here is that this is a directory with a foo_test.go file but no other go
files. 'go build' and 'go install' have nothing to work with. I can fix the error to be
like:
go install github.com/fudanchii/A/c: no buildable Go source files in
/Users/rsc/g/src/github.com/fudanchii/A/c
I am not sure there's much more to do. It seems like a mistake for go install to
silently do nothing for a directory it has been asked to work on. The ... cannot exclude
these 'test-only' packages because then 'go test ./...' doesn't work. 
It has never been our intent to support package directories that contain only tests.
It's an interesting use case but it's not planned for in the tool and it is difficult to
support. But we'll make the error better.

Status changed to Accepted.

@gopherbot
Copy link

Comment 3:

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

@rsc
Copy link
Contributor

rsc commented May 12, 2014

Comment 4:

This issue was closed by revision f409681.

Status changed to Fixed.

@rsc rsc added this to the Go1.3 milestone Apr 14, 2015
@rsc rsc removed the release-go1.3 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants