-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
gotest produces a _testmain.go which doesn't compile when the testing a package called "examples" #2346
Labels
Comments
Need to use _examples_ or something like that as the variable name. Owner changed to @adg. Status changed to Accepted. |
Changing just the variable name examples to _examples_ solves it for "examples" package, but the same conflict can still happen when testing a package whose name is the same as one of the other variables (tests, benchmarks, matchPat, matchRe, pat, str, result, err) or one of the other imports (testing, __os__, __regexp__). Why not change gotest to produce something like this? import sut "examples" var tests = []testing.InternalTest{ {"examples.TestFoo", sut.TestFoo}, } I hacked gotest to generate a file like that (see the attachment) and it worked at least in the above situation. Though it might not work if gotest imports tests from multiple packages (is it possible?), in which case prefixing the imported packages might be needed. Attachments:
|
Sounds like a reasonable solution; please send us a CL. http://golang.org/doc/contribute.html Thanks! Russ |
CL created: http://golang.org/cl/5254061/ |
This issue was closed by revision edd1c91. Status changed to Fixed. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by esko.luontola:
Attachments:
The text was updated successfully, but these errors were encountered: