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 invalid characters in build directory #71466

Open
merlinz01 opened this issue Jan 28, 2025 · 1 comment
Open

cmd/go: panic with invalid characters in build directory #71466

merlinz01 opened this issue Jan 28, 2025 · 1 comment
Labels
GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@merlinz01
Copy link

Go version

go version go1.23.2 linux/amd64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/xxx/.cache/go-build'
GOENV='/home/xxx/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/xxx/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/xxx/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/linux_amd64'
GOVCS=''
GOVERSION='go1.23.2'
GODEBUG=''
GOTELEMETRY='on'
GOTELEMETRYDIR='/home/xxx/.config/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/my/project/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 -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1703176901=/tmp/go-build -gno-record-gcc-switches'

What did you do?

Run the command go build "^\n" in any directory in a bash terminal.

What did you see happen?

$ go build "^\n"
panic: path "^\\n" not in error "invalid import path \"^\\\\n\"" [recovered]
	panic: path "^\\n" not in error "invalid import path \"^\\\\n\""

goroutine 1 [running]:
cmd/go/internal/load.(*preload).flush(0xc000039270)
	cmd/go/internal/load/pkg.go:1082 +0x74
panic({0xa24c40?, 0xc000039320?})
	runtime/panic.go:785 +0x132
cmd/go/internal/load.ImportErrorf({0x7fffabb57f95, 0x3}, {0xaff36f?, 0x3?}, {0xc0001b5398?, 0xc0001b5710?, 0x0?})
	cmd/go/internal/load/pkg.go:542 +0x174
cmd/go/internal/load.(*Package).load(0xc0001c4008, {0xc1a0f0, 0xfefbc0}, {0x0, 0x0, 0x0, 0x1, 0x0, 0x0}, {0x7fffabb57f95, ...}, ...)
	cmd/go/internal/load/pkg.go:1901 +0x1214
cmd/go/internal/load.loadImport({0xc1a0f0, 0xfefbc0}, {0x0, 0x0, 0x0, 0x1, 0x0, 0x0}, 0xc000039270, {0x7fffabb57f95, ...}, ...)
	cmd/go/internal/load/pkg.go:744 +0x52f
cmd/go/internal/load.PackagesAndErrors({0xc1a0f0?, 0xfefbc0?}, {0x0, 0x0, 0x0, 0x1, 0x0, 0x0}, {0xc0000224a0, 0x1, ...})
	cmd/go/internal/load/pkg.go:2837 +0xa0b
cmd/go/internal/work.runBuild({0xc1a0f0, 0xfefbc0}, 0xc0000286a8?, {0xc0000224a0, 0x1, 0x1})
	cmd/go/internal/work/build.go:470 +0xe8
main.invoke(0xfc1300, {0xc000022490, 0x2, 0x2})
	cmd/go/main.go:299 +0x84e
main.main()
	cmd/go/main.go:213 +0xea5

What did you expect to see?

malformed import path "^": invalid char '^'
@cagedmantis cagedmantis added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. GoCommand cmd/go labels Jan 28, 2025
@cagedmantis
Copy link
Contributor

@matloob @samthanawalla

@cagedmantis cagedmantis added this to the Backlog milestone Jan 28, 2025
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

2 participants