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

go/types: panic: invalid package name "_" #20231

Closed
josharian opened this issue May 4, 2017 · 1 comment
Closed

go/types: panic: invalid package name "_" #20231

josharian opened this issue May 4, 2017 · 1 comment

Comments

@josharian
Copy link
Contributor

josharian commented May 4, 2017

package p
	
import "_"

Check with go/types, using Config:

	conf := types.Config{
		Error:    func(err error) {}, // important for reproduction
	}

Result is panic while executing conf.Check:

panic: invalid package name _ [recovered]
	panic: invalid package name _ [recovered]
	panic: invalid package name _

goroutine 18 [running]:
testing.tRunner.func1(0xc4200f80f0)
	/Users/josh/go/tip/src/testing/testing.go:712 +0x256
panic(0x12914e0, 0x1334390)
	/Users/josh/go/tip/src/runtime/panic.go:489 +0x259
go/types.(*Checker).handleBailout(0xc4200fa000, 0xc420071d18)
	/Users/josh/go/tip/src/go/types/check.go:225 +0xa4
panic(0x12914e0, 0x1334390)
	/Users/josh/go/tip/src/runtime/panic.go:489 +0x259
go/types.NewPackage(0xc420088391, 0x1, 0xc420088391, 0x1, 0xffffffffffffffff)
	/Users/josh/go/tip/src/go/types/package.go:27 +0x439
go/types.(*Checker).importPackage(0xc4200fa000, 0x15, 0xc420088391, 0x1, 0x12f52f4, 0x1, 0x9)
	/Users/josh/go/tip/src/go/types/resolver.go:172 +0x460
go/types.(*Checker).collectObjects(0xc4200fa000)
	/Users/josh/go/tip/src/go/types/resolver.go:243 +0x1c04
go/types.(*Checker).checkFiles(0xc4200fa000, 0xc420046e30, 0x1, 0x1, 0x0, 0x0)
	/Users/josh/go/tip/src/go/types/check.go:237 +0xa1
go/types.(*Checker).Files(0xc4200fa000, 0xc420046e30, 0x1, 0x1, 0xc420080c90, 0x0)
	/Users/josh/go/tip/src/go/types/check.go:230 +0x49
go/types.(*Config).Check(0xc42008ab80, 0x12f531e, 0x1, 0xc42008ab00, 0xc420046e30, 0x1, 0x1, 0xc4200955e0, 0x0, 0x1, ...)
	/Users/josh/go/tip/src/go/types/api.go:351 +0x1b3
go/types_test.TestIssue16902(0xc4200f80f0)
	/Users/josh/go/tip/src/go/types/sizes_test.go:102 +0x2ad
testing.tRunner(0xc4200f80f0, 0x130bc80)
	/Users/josh/go/tip/src/testing/testing.go:747 +0xd0
created by testing.(*T).Run
	/Users/josh/go/tip/src/testing/testing.go:789 +0x2de
exit status 2

Discovered with go-fuzz.

@griesemer @mvdan

@gopherbot
Copy link

CL https://golang.org/cl/42852 mentions this issue.

@golang golang locked and limited conversation to collaborators May 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants