Go Tool Incomplete Error Messages

40 views
Skip to first unread message

Carlos Castillo

unread,
Jan 20, 2012, 11:37:43 AM1/20/12
to golang-nuts
I am using weekly.2012-01-20 on Mac OS X 10.6.8 (darwin-386) and I've
noticed a problem with the error reporting for the go tool.

When I have an error in the import statements the message provided is
far less useful to determining the problem:

$ cat foo.go
package foo
import (
"bar" // There is no package bar
"testing"
)
func TestFoo(t *testing.T) {
}
$ 8g foo.go
foo.go:4: can't find import: "bar"
$ go build
.: import bar
package could not be found locally
.: import bar
package could not be found locally

The error message provided by the go tool omits the file name and line
number making it much more difficult to find the problem in a large
package.

The problem is even worse for go test, by renaming the above file to
foo_test.go and having a valid foo.go:

$ mv foo.go foo_test.go
$ echo package foo > foo.go
$ go test
package could not be found locally

The error message is even worse since it doesn't even tell me which
package couldn't be found.

Carlos Castillo

unread,
Jan 21, 2012, 4:42:16 PM1/21/12
to golang-nuts
Silly me, it was being tracked:
http://code.google.com/p/go/issues/detail?id=2664
Reply all
Reply to author
Forward
0 new messages