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/fix: "go tool fix -r cftype" panic: ast.Expr is *ast.ArrayType, not *ast.SelectorExpr #23762

Closed
pquerna opened this issue Feb 9, 2018 · 3 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@pquerna
Copy link

pquerna commented Feb 9, 2018

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

go version go1.10rc2 darwin/amd64

What did you do?

Ran cftype fixer on a proprietary module. Trying to find a smaller test case, but this is the panic:

$ go1.10rc2 tool fix -r cftype .
panic: interface conversion: ast.Expr is *ast.ArrayType, not *ast.SelectorExpr

goroutine 1 [running]:
main.typefix.func3(0x1119980, 0xc42011c440)
	/usr/local/go/src/cmd/fix/cftype.go:122 +0x646
main.walkBeforeAfter(0x1119980, 0xc42011c440, 0x1145f38, 0xc42014d860)
	/usr/local/go/src/cmd/fix/fix.go:283 +0x196
main.walkBeforeAfter(0x1105d60, 0xc42005a600, 0x1145f38, 0xc42014d860)
	/usr/local/go/src/cmd/fix/fix.go:71 +0x985
main.walkBeforeAfter(0x111aa00, 0xc42005a600, 0x1145f38, 0xc42014d860)
	/usr/local/go/src/cmd/fix/fix.go:133 +0x2365
main.walkBeforeAfter(0x1105d60, 0xc42010f450, 0x1145f38, 0xc42014d860)
	/usr/local/go/src/cmd/fix/fix.go:71 +0x985
main.walkBeforeAfter(0x110a400, 0xc4203a59e0, 0x1145f38, 0xc42014d860)
	/usr/local/go/src/cmd/fix/fix.go:268 +0xefb
main.walkBeforeAfter(0x11054a0, 0xc42011c4a8, 0x1145f38, 0xc42014d860)
	/usr/local/go/src/cmd/fix/fix.go:95 +0xf9b
main.walkBeforeAfter(0x1119580, 0xc42011c480, 0x1145f38, 0xc42014d860)
	/usr/local/go/src/cmd/fix/fix.go:190 +0x2a44
main.walkBeforeAfter(0x1105e20, 0xc420035e60, 0x1145f38, 0xc42014d860)
	/usr/local/go/src/cmd/fix/fix.go:75 +0x14f7
main.walkBeforeAfter(0x110a4c0, 0xc4203a48c0, 0x1145f38, 0xc42014d860)
	/usr/local/go/src/cmd/fix/fix.go:276 +0x896
main.walkBeforeAfter(0x1105520, 0xc420115178, 0x1145f38, 0xc42014d860)
	/usr/local/go/src/cmd/fix/fix.go:103 +0x282
main.walkBeforeAfter(0x1119880, 0xc420115170, 0x1145f38, 0xc42014d860)
	/usr/local/go/src/cmd/fix/fix.go:199 +0x2d22
main.walkBeforeAfter(0x1103c20, 0xc4201151c0, 0x1145f38, 0xc42014d860)
	/usr/local/go/src/cmd/fix/fix.go:79 +0xff7
main.walkBeforeAfter(0x111a000, 0xc4201151a0, 0x1145f38, 0xc42014d860)
	/usr/local/go/src/cmd/fix/fix.go:249 +0x592
main.walkBeforeAfter(0x1105d20, 0xc42008feb0, 0x1145f38, 0xc42014d860)
	/usr/local/go/src/cmd/fix/fix.go:69 +0x2623
main.walkBeforeAfter(0x110a3c0, 0xc4203a2960, 0x1145f38, 0xc42014d860)
	/usr/local/go/src/cmd/fix/fix.go:264 +0x7ef
main.walkBeforeAfter(0x1105460, 0xc42012a618, 0x1145f38, 0xc42014d860)
	/usr/local/go/src/cmd/fix/fix.go:93 +0x18c0
main.walkBeforeAfter(0x11172a0, 0xc42012a600, 0x1145f38, 0xc42014d860)
	/usr/local/go/src/cmd/fix/fix.go:253 +0x1bb0
main.walk(0x11172a0, 0xc42012a600, 0xc42014d860)
	/usr/local/go/src/cmd/fix/fix.go:51 +0x4b
main.typefix(0xc42012a600, 0x1145f00, 0xc420001e00)
	/usr/local/go/src/cmd/fix/cftype.go:102 +0x2d2
main.cftypefix(0xc42012a600, 0xc42007a210)
	/usr/local/go/src/cmd/fix/cftype.go:33 +0x37
main.processFile(0xc4200132c0, 0x1b, 0x100, 0x0, 0x0)
	/usr/local/go/src/cmd/fix/main.go:150 +0x259
main.visitFile(0xc4200132c0, 0x1b, 0x115a0a0, 0xc4200c9ee0, 0x0, 0x0, 0x1b, 0xc4200bdd38)
	/usr/local/go/src/cmd/fix/main.go:227 +0x9c
path/filepath.walk(0xc4200132c0, 0x1b, 0x115a0a0, 0xc4200c9ee0, 0x1145f50, 0x0, 0x0)
	/usr/local/go/src/path/filepath/path.go:357 +0x402
path/filepath.walk(0x7ffeefbff9b1, 0x1, 0x115a0a0, 0xc42007cc30, 0x1145f50, 0x0, 0xc420090000)
	/usr/local/go/src/path/filepath/path.go:381 +0x2c2
path/filepath.Walk(0x7ffeefbff9b1, 0x1, 0x1145f50, 0x0, 0x0)
	/usr/local/go/src/path/filepath/path.go:403 +0x106
main.walkDir(0x7ffeefbff9b1, 0x1)
	/usr/local/go/src/cmd/fix/main.go:222 +0x41
main.main()
	/usr/local/go/src/cmd/fix/main.go:94 +0x185

What did you expect to see?

An error, or fixed code.

What did you see instead?

panic'ed.

@ianlancetaylor
Copy link
Contributor

We may need to see a test case in order to fix this.

CC @randall77 @griesemer

@ianlancetaylor ianlancetaylor added this to the Go1.10 milestone Feb 9, 2018
@ianlancetaylor ianlancetaylor added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Feb 9, 2018
@gopherbot
Copy link

Change https://golang.org/cl/93078 mentions this issue: cmd/fix: fix cast check

@randall77
Copy link
Contributor

Thanks for the report. Looks like just a stupid bug on my part.

@golang golang locked and limited conversation to collaborators Feb 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge 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