-
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
cmd/go: unable to test a package if it's import path is main #10738
Comments
What bad effects are you talking about?
the main package is where the Go program starts execution, it's documented
in the spec:
http://golang.org/ref/spec#Program_execution
|
Sorry, I've checked further. The problem is actually having a directory called main. I had naively assumed that with one package per directory, one should call the directory the same name as the package it contains. Apparently, this does not work for package main. (So what minux says is correct, but there is still a problem; I have updated the original post). |
What are the "bad effects"? |
See https://groups.google.com/forum/#!topic/golang-nuts/ubYw0OQXLvA |
The problem is that the test driver (_testmain.go) needs to import the The reason is simple, the packages in Go program must have unique import This is working as intended. |
ok, but this should be documented so other newbies do not make the same Regards, On 7 May 2015 at 14:09, Minux Ma notifications@github.com wrote:
|
It seems that
calling a packageusing a directorymain
has special (bad) effects. Please document this in the documentationfor the package statement.You also might want to issue a warning if anyone tries to
define a packageuse a folder calledmain
.Corrected to reflect minux' comment below.
The text was updated successfully, but these errors were encountered: