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: go test doesn't reject some x -> x_test references #6208

Closed
adonovan opened this issue Aug 21, 2013 · 2 comments
Closed

cmd/go: go test doesn't reject some x -> x_test references #6208

adonovan opened this issue Aug 21, 2013 · 2 comments

Comments

@adonovan
Copy link
Member

'go test' doesn't reject some x -> x_test references.
As a result, a package may pass its tests yet not build.

% cat b/b.go
package b
var Y = X

% cat b/b_test.go
package b
var X = 0

% go test b
ok      b       0.016s

% go build b
b/b.go:2: undefined: X
@robpike
Copy link
Contributor

robpike commented Aug 21, 2013

Comment 1:

It seems pretty unlikely that this will be detected without special casing it in the
compiler, which at the moment knows nothing about the x_test.go magic, and since it is
caught as soon as you run 'go build' it's not a high priority issue.
Marking WontFix; please reopen if you have a compelling counterargument.

Status changed to WontFix.

@rsc
Copy link
Contributor

rsc commented Sep 3, 2013

Comment 2:

Seems like unnecessary work. If you want to build the package, use 'go
build', not 'go test'.

@golang golang locked and limited conversation to collaborators Jun 24, 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