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: fillstruct with anonymous structs panics #40980

leitzler opened this issue Aug 22, 2020 · 2 comments

x/tools/gopls: fillstruct with anonymous structs panics #40980

leitzler opened this issue Aug 22, 2020 · 2 comments


Copy link

@leitzler leitzler commented Aug 22, 2020

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

$ go version
go version go1.15 darwin/amd64 v0.0.0-20200820180210-c8f393745106 v0.0.0-20200820180210-c8f393745106

What did you do?

Called fillstruct at foo{} with a struct that contain an anonymous struct as field. Also added maps with anonymous struct and interface values since it behaves the same.

package main

type foo struct {
    a struct{}
    b map[string]interface{}
    c map[string]struct{}

func main() {
    _ = foo{}

What did you expect to see?

Struct filled.

What did you see instead?

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x13d437a]

goroutine 546 [running]:*Command).SuggestedFix(0x1f03700, 0x1acc060, 0xc000206500, 0x1adc960, 0xc00043ac60, 0x1ad4060, 0xc00011a480, 0x4022000000000000, 0x4020000000000000, 0x4022000000000000, ...)
   /Users/leitzler/go/pkg/mod/ +0x1fa*Server).executeCommand(0xc0000e5340, 0x1acc060, 0xc000206500, 0xc00016ae40, 0x0, 0x0, 0x0, 0x0)
   /Users/leitzler/go/pkg/mod/ +0x17fa*Server).ExecuteCommand(0xc0000e5340, 0x1acc060, 0xc000206500, 0xc00016ae40, 0xc00016ae40, 0x0, 0x0, 0x0)
   /Users/leitzler/go/pkg/mod/ +0x49, 0xc000206500, 0x1adfde0, 0xc0000e5340, 0xc00025d290, 0x1acc2a0, 0xc000206480, 0x1ab99e0, 0xc0002546e0, 0x1acc120)
   /Users/leitzler/go/pkg/mod/ +0x3872, 0xc000206500, 0xc00025d290, 0x1acc2a0, 0xc000206480, 0x1f1f9a0, 0x1aca520)
   /Users/leitzler/go/pkg/mod/ +0xc5, 0xc000206500, 0xc00025d290, 0x1acc2a0, 0xc000206480, 0x0, 0x0)
   /Users/leitzler/go/pkg/mod/ +0x432, 0xc000206500, 0xc0002ed3a0, 0x1acc2a0, 0xc000206480, 0x17505ae, 0xc000437088)
   /Users/leitzler/go/pkg/mod/ +0xcf, 0xc000445830, 0xc0002cd1f0, 0x1acc060, 0xc000206500, 0xc0002ed3a0, 0x1acc2a0, 0xc000206480)
   /Users/leitzler/go/pkg/mod/ +0x86
created by
   /Users/leitzler/go/pkg/mod/ +0x173
@gopherbot gopherbot added this to the Unreleased milestone Aug 22, 2020
Copy link

@gopherbot gopherbot commented Aug 22, 2020

Change mentions this issue: internal/analysisinternal: add anonymous structs & interfaces to

Copy link
Contributor Author

@leitzler leitzler commented Aug 22, 2020

(also see that address the panic)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants