Go Tool Incomplete Error Messages

40 visualizações
Ir para a primeira mensagem não lida

Carlos Castillo

não lida,
20/01/2012, 11:37:4320/01/12
para 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

não lida,
21/01/2012, 16:42:1621/01/12
para golang-nuts
Silly me, it was being tracked:
http://code.google.com/p/go/issues/detail?id=2664
Responder a todos
Responder ao autor
Reencaminhar
0 mensagens novas