Closed
Description
On the go1.11 branch, packages within the module are shadowed by packages happening to be in GOPATH as well. This does not happen for regular Go, only GopherJS.
Consider the following layout, with GOPATH set to "/.../topdir/gopath".
topdir
├───foomod
│ └───bar
└───gopath
└───src
└───foo
└───bar
$ cat foomod/go.mod
module foo
$ cat foomod/main.go
package main // import "foo"
import "foo/bar"
func main() {
bar.Bar()
}
$ cat foomod/bar/bar.go
package bar
import "fmt"
func Bar() {
fmt.Println("Hello from module foo!")
}
$ cat gopath/src/foo/bar/bar.go
package bar
import "fmt"
func Bar() {
fmt.Println("Hello from GOPATH!")
}
With Go:
$ cd foomod/
$ go run .
Hello from module foo!
With gopherjs on branch go1.11 I get "Hello from GOPATH!". If I remove the version checked out in GOPATH, I get the expected "Hello from module foo!".
Metadata
Metadata
Assignees
Labels
No labels