google / capslock

BSD 3-Clause "New" or "Revised" License
810 stars 27 forks source link

capslock panics with Go1.22 #87

Closed szuecs closed 9 months ago

szuecs commented 9 months ago
:~/go/src/github.com/zalando/skipper]% make capslock
capslock -output=v -packages=./...
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x5cb67e]

goroutine 642 gp=0xc0012041c0 m=3 mp=0xc0000a0008 [running]:
panic({0x7e6620?, 0xb6d770?})
        /usr/share/go/src/runtime/panic.go:779 +0x158 fp=0xc001074ae8 sp=0xc001074a38 pc=0x43abb8
go/types.(*Checker).handleBailout(0xc001064200, 0xc001079bd0)
        /usr/share/go/src/go/types/check.go:367 +0x88 fp=0xc001074b08 sp=0xc001074ae8 pc=0x588308
go/types.(*Checker).checkFiles.deferwrap1()
        /usr/share/go/src/go/types/check.go:392 +0x25 fp=0xc001074b28 sp=0xc001074b08 pc=0x5888c5
panic({0x7e6620?, 0xb6d770?})
        /usr/share/go/src/runtime/panic.go:770 +0x132 fp=0xc001074bd8 sp=0xc001074b28 pc=0x43ab92
runtime.panicmem(...)
        /usr/share/go/src/runtime/panic.go:261
runtime.sigpanic()
        /usr/share/go/src/runtime/signal_unix.go:881 +0x378 fp=0xc001074c38 sp=0xc001074bd8 pc=0x453398
go/types.(*StdSizes).Sizeof(0x0, {0x8ed2e8, 0xb72da0})
        /usr/share/go/src/go/types/sizes.go:228 +0x31e fp=0xc001074c98 sp=0xc001074c38 pc=0x5cb67e
go/types.Sizes.Sizeof-fm({0x8ed2e8?, 0xb72da0?})
        <autogenerated>:1 +0x38 fp=0xc001074cc0 sp=0xc001074c98 pc=0x5ee178
go/types.(*Config).sizeof(...)
        /usr/share/go/src/go/types/sizes.go:333
go/types.representableConst.func1({0x8ed2e8?, 0xb72da0?})
        /usr/share/go/src/go/types/const.go:76 +0x9e fp=0xc001074d10 sp=0xc001074cc0 pc=0x58af9e
go/types.representableConst({0x8ef678, 0xb645b0}, 0xc001064200, 0xb72da0, 0xc001074e08)
        /usr/share/go/src/go/types/const.go:106 +0x2c7 fp=0xc001074de0 sp=0xc001074d10 pc=0x58a747
go/types.(*Checker).representation(0xc001064200, 0xc00106e580, 0xb72da0)
        /usr/share/go/src/go/types/const.go:256 +0x65 fp=0xc001074e28 sp=0xc001074de0 pc=0x58b325
go/types.(*Checker).representable(0xc001064200, 0xc00106e580, 0xb72da0)
        /usr/share/go/src/go/types/const.go:239 +0x26 fp=0xc001074e70 sp=0xc001074e28 pc=0x58b206
go/types.(*Checker).shift(0xc001064200, 0xc00106e4c0, 0xc00106e580, {0x8ee868, 0xc0010203f0}, 0x14)
        /usr/share/go/src/go/types/expr.go:650 +0x1eb fp=0xc001075110 sp=0xc001074e70 pc=0x59b2eb
go/types.(*Checker).binary(0xc001064200, 0xc00106e4c0, {0x8ee868, 0xc0010203f0}, {0x8ee6e8, 0xc0010265e0}, {0x8ee628, 0xc001026600}, 0x14, 0x7323)

Latest capslock was installed by:

go install github.com/google/capslock/cmd/capslock@latest
jcd2 commented 9 months ago

Thanks for the report!

I've added a new version tag v0.2.0 for capslock at the latest commit. This problem should be fixed there, and go install github.com/google/capslock/cmd/capslock@latest should pick up this version now.

szuecs commented 9 months ago

@jcd2 thanks for the fix!