gopherjs icon indicating copy to clipboard operation
gopherjs copied to clipboard

"cannot find package" errors could be more informative

Open flimzy opened this issue 10 years ago • 3 comments

Consider this error from gopherjs build:

cannot find package "github.com/flimzy/flashback/pages" in any of:
        /usr/local/go/src/github.com/flimzy/flashback/pages (from $GOROOT)
        /home/jonhall/go/src/github.com/flimzy/flashback/pages (from $GOPATH)

It's almost identical to the same error from go build:

cmd/server/server.go:4:2: cannot find package "oink" in any of:
        /usr/local/go/src/oink (from $GOROOT)
        /home/jonhall/go/src/oink (from $GOPATH)

Except that the go version tells me where the missing dependency is referenced ("cmd/server.go:4:2").

It would be very handy if GopherJS did the same thing :)

flimzy avatar Aug 31 '15 21:08 flimzy

Agreed, this should be improved so gopherjs build output shows the filename and line number information just like go build does.

dmitshur avatar Sep 01 '15 05:09 dmitshur

I've looked into this, it turns out it's a regression caused by commit https://github.com/gopherjs/gopherjs/commit/642a7f3fafe4dc7c01179a830271aadd54641fdd which attempted to fix #119.

I'll make a PR that resolves this issue. Edit: Done in https://github.com/gopherjs/gopherjs/pull/291.

dmitshur avatar Sep 01 '15 05:09 dmitshur

Despite #291, this seems to still be an issue:

package main

import (
        _ "oink"
)

func main() {
}
$ gopherjs build
cannot find package "oink" in any of:
        /usr/local/go/src/oink (from $GOROOT)
        ($GOPATH not set. For more details see: 'go help gopath')

nevkontakte avatar Oct 23 '21 23:10 nevkontakte