-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Labels
FrozenDueToAgeGoCommandcmd/gocmd/goNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Description
What version of Go are you using (go version
)?
$ go version go version go1.21.0 darwin/arm64
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GO111MODULE='' GOARCH='arm64' GOBIN='' GOCACHE='/Users/gopher/Library/Caches/go-build' GOENV='/Users/gopher/Library/Application Support/go/env' GOEXE='' GOEXPERIMENT='' GOFLAGS='' GOHOSTARCH='arm64' GOHOSTOS='darwin' GOINSECURE='' GOMODCACHE='/Users/gopher/go/pkg/mod' GONOPROXY='' GONOSUMDB='' GOOS='darwin' GOPATH='/Users/gopher/go' GOPRIVATE='' GOPROXY='https://proxy.golang.org,direct' GOROOT='/usr/local/go' GOSUMDB='sum.golang.org' GOTMPDIR='' GOTOOLCHAIN='auto' GOTOOLDIR='/usr/local/go/pkg/tool/darwin_arm64' GOVCS='' GOVERSION='go1.21.0' GCCGO='gccgo' AR='ar' CC='clang' CXX='clang++' CGO_ENABLED='1' GOMOD='/dev/null' GOWORK='' CGO_CFLAGS='-O2 -g' CGO_CPPFLAGS='' CGO_CXXFLAGS='-O2 -g' CGO_FFLAGS='-O2 -g' CGO_LDFLAGS='-O2 -g' PKG_CONFIG='pkg-config' GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/s_/5sjqzr0j6xggz_xtzmq_8r4m00jwcj/T/go-build4187513592=/tmp/go-build -gno-record-gcc-switches -fno-common'
What did you do?
I tried building a Go program, while using GOTOOLCHAIN to select an older version of the Go toolchain (1.20.7 instead of 1.21.0), that should fail because it imports a package that doesn't exist in the Go standard library at that version:
package p
import _ "pkgnotinstd"
$ GOTOOLCHAIN=go1.20.7 go build
(The real thing I was doing was using GOTOOLCHAIN=<older toolchain> go test ./...
to check that my change that starts to use Go 1.21's new "slices" package in a build-constrained .go file didn't accidentally break with older supported Go releases too.)
What did you expect to see?
An error message that mentions the name of the package. For example, something like:
p.go:3:8: package pkgnotinstd is not in std (/usr/local/go/src/pkgnotinstd)
Or more realistically, the less-improved error message as implemented in Go 1.20.7:
p.go:3:8: package pkgnotinstd is not in GOROOT (/usr/local/go/src/pkgnotinstd)
What did you see instead?
An error message that says "" instead of the package name or path:
p.go:3:8: import "": import of unknown directory
jweir
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeGoCommandcmd/gocmd/goNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.