You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a regression in go1.14rc1 when calling Import with an empty srcDir parameter in build.FindOnly mode, on an import path of a Go package that produces errors when loading (e.g., due to build constraints not matching the current build context).
This regression applies only when in module mode. It's related to but not the same as issue #31603.
To reproduce:
# Initial setup.
$ cd$(mktemp -d)
$ export GOPATH=$(mktemp -d)
$ GO111MODULE=off go get -d golang.org/x/exp/shiny/driver
$ export GO111MODULE=on
# Test program.
$ go mod init issue37153.test
$ cat >main.go <<EOFpackage mainimport ( "fmt" "go/build")func main() { pkg, err := build.Import("golang.org/x/exp/shiny/example/goban/asset", "", build.FindOnly) fmt.Printf("pkg.Dir=%q err=%v\n", pkg.Dir, err)}EOF# Previous versions of Go.
$ go1.11.13 run .
pkg.Dir="/tmp/tmp.WqlneM7y/src/golang.org/x/exp/shiny/example/goban/asset" err=<nil>
$ go1.12.16 run .
pkg.Dir="/tmp/tmp.WqlneM7y/src/golang.org/x/exp/shiny/example/goban/asset" err=<nil>
$ go1.13.7 run .
pkg.Dir="/tmp/tmp.WqlneM7y/src/golang.org/x/exp/shiny/example/goban/asset" err=<nil># Upcoming version of Go.
$ go1.14rc1 run .
pkg.Dir="" err=package golang.org/x/exp/shiny/example/goban/asset: build constraints exclude all Go files in /tmp/tmp.WqlneM7y/pkg/mod/golang.org/x/[email protected]/shiny/example/goban/asset
I've investigated this and found the root cause. See the commit message of CL 218817 for details.
The fix in CL 218817 seems small, targeted, and safe to make. It results in the following output:
# CL 218817.
$ go run .
pkg.Dir="/tmp/tmp.ERHcBPHO/pkg/mod/golang.org/x/[email protected]/shiny/example/goban/asset" err=<nil>
I think we should consider fixing this for 1.14, because the build.Import("some/import/path", "", build.FindOnly) pattern is quite common for finding the location of a package, and I think we should not break it unnecessarily.
I've tentatively milestoned this for 1.14, but I'm open to discussion depending on how others feel.
There is a regression in go1.14rc1 when calling
Import
with an empty srcDir parameter inbuild.FindOnly
mode, on an import path of a Go package that produces errors when loading (e.g., due to build constraints not matching the current build context).This regression applies only when in module mode. It's related to but not the same as issue #31603.
To reproduce:
I've investigated this and found the root cause. See the commit message of CL 218817 for details.
The fix in CL 218817 seems small, targeted, and safe to make. It results in the following output:
I think we should consider fixing this for 1.14, because the
build.Import("some/import/path", "", build.FindOnly)
pattern is quite common for finding the location of a package, and I think we should not break it unnecessarily.I've tentatively milestoned this for 1.14, but I'm open to discussion depending on how others feel.
/cc @bcmills @jayconrod @matloob
The text was updated successfully, but these errors were encountered: