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

x/tools/gopls: panic in structtag analyzer #33689

muirrn opened this issue Aug 16, 2019 · 4 comments


Copy link

commented Aug 16, 2019

I've started to see this panic sometimes as I type:

panic: interface conversion: types.Type is nil, not *types.Struct

goroutine 9909 [running]:, 0xc01c8f8ca0)
	/Users/muir/projects/tools/go/analysis/passes/structtag/structtag.go:43 +0x15c*Inspector).Preorder(0xc02446f500, 0xc0108facb0, 0x1, 0x1, 0xc0108faca0)
	/Users/muir/projects/tools/go/ast/inspector/inspector.go:77 +0x9f, 0xc016181600, 0xc00002a3e0, 0xc008f81600, 0x9)
	/Users/muir/projects/tools/go/analysis/passes/structtag/structtag.go:42 +0xca*Action).execOnce(0xc024473c80, 0x17cb480, 0xc0244708c0, 0xc00021c840, 0xc0031d46c8, 0x10)
	/Users/muir/projects/tools/internal/lsp/source/analysis.go:174 +0x80b*Action).exec.func1()
	/Users/muir/projects/tools/internal/lsp/source/analysis.go:108 +0x4e
sync.(*Once).Do(0xc024473c80, 0xc0031d4708)
	/usr/local/go/src/sync/once.go:44 +0xb3*Action).exec(0xc024473c80, 0x17cb480, 0xc0244708c0, 0xc00021c840, 0xc00c59edd0, 0xc0031d4790)
	/Users/muir/projects/tools/internal/lsp/source/analysis.go:107 +0x8b, 0x170d780)
	/Users/muir/projects/tools/internal/lsp/source/analysis.go:99 +0x48*Group).Go.func1(0xc024ec2420, 0xc02446f240)
	/Users/muir/projects/<project>/go/pkg/mod/ +0x57
created by*Group).Go
	/Users/muir/projects/<project>/go/pkg/mod/ +0x66

@gopherbot gopherbot added this to the Unreleased milestone Aug 16, 2019

@gopherbot gopherbot added the gopls label Aug 16, 2019


This comment has been minimized.

Copy link

commented Aug 16, 2019

Does the code that this happens in have build tags? I wouldn't be surprised if this were another instance of #32413.


This comment has been minimized.

Copy link

commented Aug 16, 2019

No build tags involved in this case, but you are probably right it is the same issue. I assume type information was incomplete because I was in the middle of typing, but we still run the analyzers (#32413 (comment)). Closing as dupe of #32413.

@muirrn muirrn closed this Aug 16, 2019


This comment has been minimized.

Copy link

commented Aug 16, 2019

Well, we shouldn't run analyzers if the type information is incomplete actually - we only run analyses when we didn't return any diagnostics for the file.

@stamblerre stamblerre reopened this Aug 16, 2019


This comment has been minimized.

Copy link

commented Aug 20, 2019

Change mentions this issue: go/analysis: handle common nil pointers

gopherbot pushed a commit to golang/tools that referenced this issue Aug 24, 2019
go/analysis: handle common nil pointers
Updates golang/go#33727, golang/go#33689

Change-Id: Ie32ac4efc9fe0d7b08fcff3feb44b28d83df942d
Run-TryBot: Rebecca Stambler <>
TryBot-Result: Gobot Gobot <>
Reviewed-by: Michael Matloob <>

@gopherbot gopherbot added the Tools label Sep 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.