Here is the code
a.go
package main
import "fmt"
func Haha() {
fmt.Println("in Haha")
}
func main() {
}
a_test.go
package main_test
import "testing"
func TestA(t *testing.T) {
Haha()
}
go build
works. But when I run ~/gopath/src/zjk/misc$ go test -v
. Here is what I get
# zjk/misc_test
./a_test.go:6: undefined: Haha
FAIL zjk/misc [build failed]