Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: panic with empty import #61224

Closed
thierry-f-78 opened this issue Jul 7, 2023 · 5 comments
Closed

cmd/go: panic with empty import #61224

thierry-f-78 opened this issue Jul 7, 2023 · 5 comments
Labels
GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Comments

@thierry-f-78
Copy link

What version of Go are you using (go version)?

$ go version
go version go1.20.5 darwin/amd64

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="amd64"
GOBIN=""
GOCACHE="/Users/thierry/Library/Caches/go-build"
GOENV="/Users/thierry/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/thierry/go/pkg/mod"
GONOPROXY="xxx"
GONOSUMDB="xxx"
GOOS="darwin"
GOPATH="/Users/thierry/go"
GOPRIVATE="xxx"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.20.5"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/thierry/git/tools/gofuse/go.mod"
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 x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/_d/zs7l5ldx1r94fn_qh1zvn1rw0000gn/T/go-build2033600722=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

package main
import ""

go build

panic: loadPackageData called with empty package path

goroutine 35 [running]:
cmd/go/internal/load.loadPackageData({0x1747538, 0xc000112010}, {0xc00009c5d6, 0x0}, {0xc000112ec8, 0x8}, {0xc0000a2840, 0x21}, {0xc00002e0c4, 0x1f}, ...)
	/usr/local/go/src/cmd/go/internal/load/pkg.go:815 +0x65d
cmd/go/internal/load.(*preload).preloadImports.func1({0xc00009c5d6?, 0x0?})
	/usr/local/go/src/cmd/go/internal/load/pkg.go:1076 +0xa5
created by cmd/go/internal/load.(*preload).preloadImports
	/usr/local/go/src/cmd/go/internal/load/pkg.go:1075 +0x2aa

Note: I tried to fix the issue myself, but I can't find the right to work in the debug mode on the go compiler.

What did you expect to see?

single line with error message

What did you see instead?

the backtrace below

@seankhliao seankhliao changed the title go compiler panic cmd/go: panic with empty import Jul 7, 2023
@seankhliao seankhliao added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. GoCommand cmd/go labels Jul 7, 2023
@Nasfame
Copy link
Contributor

Nasfame commented Jul 7, 2023

I am not getting a panic

 go run scratch_44.go
warning: GOPATH set to GOROOT (/Users/hiro/goferHiro/go) has no effect
/Users/hiro/Library/Application Support/JetBrains/GoLand2023.1/scratches/scratch_44.go:3:8: invalid import path: 

@Nasfame
Copy link
Contributor

Nasfame commented Jul 7, 2023

fixed at the tip

panicing in go1.20.5

@Nasfame
Copy link
Contributor

Nasfame commented Jul 7, 2023

goimports is throwing the error as expected in go1.20.5

invalid import path: ""

@randall77
Copy link
Contributor

If this is fixed at tip I think we can just close this. The error is reported, albeit verbosely, in previous versions and is easily worked around.

@thierry-f-78
Copy link
Author

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants