timonwong / loggercheck

A linter for logr,klog,zap that can also works with golangci-lint as a plugin
MIT License
14 stars 9 forks source link

Loggercheck seem to crash after private project was upgraded to Golang 1.22.7 #88

Open MuneebAijaz opened 2 months ago

MuneebAijaz commented 2 months ago

Hi, we upgraded our project recently to golang 1.22.7, and loggercheck ./... started to crash on the pipeline with the following stack trace

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=0x59852f]
goroutine 58 [running]:
go/types.(*Checker).handleBailout(0xc000c14000, 0xc0004f3c10)
    /opt/hostedtoolcache/go/1.22.7/x64/src/go/types/check.go:367 +0x88
panic({0x718b60?, 0x9a7aa0?})
    /opt/hostedtoolcache/go/1.22.7/x64/src/runtime/panic.go:770 +0x132
go/types.(*StdSizes).Sizeof(0x0, {0x7e7780, 0x9ab720})
    /opt/hostedtoolcache/go/1.22.7/x64/src/go/types/sizes.go:228 +0x30f
go/types.(*Config).sizeof(...)
    /opt/hostedtoolcache/go/1.22.7/x64/src/go/types/sizes.go:333
go/types.representableConst.func1({0x7e7780?, 0x9ab720?})
    /opt/hostedtoolcache/go/1.22.7/x64/src/go/types/const.go:76 +0x9e
go/types.representableConst({0x7e8b98, 0xc0030115a8}, 0xc000c14000, 0x9ab720, 0xc0004ef6c0)
    /opt/hostedtoolcache/go/1.22.7/x64/src/go/types/const.go:92 +0x192
go/types.(*Checker).representation(0xc000c14000, 0xc000aa5280, 0x9ab720)
    /opt/hostedtoolcache/go/1.22.7/x64/src/go/types/const.go:256 +0x65
go/types.(*Checker).implicitTypeAndValue(0xc000c14000, 0xc000aa5280, {0x7e7780, 0x9ab720})
    /opt/hostedtoolcache/go/1.22.7/x64/src/go/types/expr.go:375 +0x2d7
go/types.(*Checker).assignment(0xc000c14000, 0xc000aa5280, {0x7e7780, 0x9ab720}, {0xc000fe62c0, 0x1b})
    /opt/hostedtoolcache/go/1.22.7/x64/src/go/types/assignments.go:52 +0x2e5
go/types.(*Checker).arguments(0xc000c14000, 0xc000aa4040, 0xc000aa51c0, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, {0xc000951890, ...}, ...)
    /opt/hostedtoolcache/go/1.22.7/x64/src/go/types/call.go:654 +0x13dc
go/types.(*Checker).callExpr(0xc000c14000, 0xc000aa5180, 0xc000aa4040)
    /opt/hostedtoolcache/go/1.22.7/x64/src/go/types/call.go:304 +0x6e9
go/types.(*Checker).exprInternal(0xc000c14000, 0x0, 0xc000aa5180, {0x7e8760, 0xc000aa4040}, {0x0, 0x0})
    /opt/hostedtoolcache/go/1.22.7/x64/src/go/types/expr.go:1374 +0xf8
go/types.(*Checker).rawExpr(0xc000c14000, 0x0, 0xc000aa5180, {0x7e8760?, 0xc000aa4040?}, {0x0?, 0x0?}, 0x0)
    /opt/hostedtoolcache/go/1.22.7/x64/src/go/types/expr.go:979 +0x19e
go/types.(*Checker).multiExpr(0xc000c14000, {0x7e8760, 0xc000aa4040}, 0x0)
    /opt/hostedtoolcache/go/1.22.7/x64/src/go/types/expr.go:1532 +0x79
go/types.(*Checker).initVars(0xc000c14000, {0xc00149c7f0, 0x1, 0x1}, {0xc000950a60, 0x1, 0x1}, {0x0, 0x0})
    /opt/hostedtoolcache/go/1.22.7/x64/src/go/types/assignments.go:408 +0x129
go/types.(*Checker).shortVarDecl(0xc000c14000, {0x7e5ce0, 0xc000f96108}, {0xc000950a30, 0x1, 0xc001041e00?}, {0xc000950a60, 0x1, 0x1})
    /opt/hostedtoolcache/go/1.22.7/x64/src/go/types/assignments.go:556 +0x8f0
go/types.(*Checker).stmt(0xc000c14000, 0x3, {0x7e83a0, 0xc000aa4080})
    /opt/hostedtoolcache/go/1.22.7/x64/src/go/types/stmt.go:473 +0x15ff
go/types.(*Checker).stmtList(0xc000c14000, 0x3, {0xc000aa4340?, 0x76b601?, 0x5?})
    /opt/hostedtoolcache/go/1.22.7/x64/src/go/types/stmt.go:121 +0x85
go/types.(*Checker).stmt(0xc000c14000, 0x3, {0x7e84c0, 0xc00250e450})
    /opt/hostedtoolcache/go/1.22.7/x64/src/go/types/stmt.go:562 +0x20f2
go/types.(*Checker).rangeStmt(0xc000c14000, 0x3, 0xc0027c63c0)
    /opt/hostedtoolcache/go/1.22.7/x64/src/go/types/stmt.go:994 +0x74d
go/types.(*Checker).stmt(0xc000c14000, 0x0, {0x7e8640, 0xc0027c63c0})
    /opt/hostedtoolcache/go/1.22.7/x64/src/go/types/stmt.go:827 +0xab9
go/types.(*Checker).stmtList(0xc000c14000, 0x0, {0xc0002691a0?, 0x0?, 0x0?})
    /opt/hostedtoolcache/go/1.22.7/x64/src/go/types/stmt.go:121 +0x85
go/types.(*Checker).funcBody(0xc000c14000, 0x7e78e8?, {0xc003011460?, 0xc000951750?}, 0xc000aa4780, 0xc00250e480, {0x0?, 0x0?})
    /opt/hostedtoolcache/go/1.22.7/x64/src/go/types/stmt.go:41 +0x331
go/types.(*Checker).funcDecl.func1()
    /opt/hostedtoolcache/go/1.22.7/x64/src/go/types/decl.go:852 +0x3a
go/types.(*Checker).processDelayed(0xc000c14000, 0x0)
    /opt/hostedtoolcache/go/1.22.7/x64/src/go/types/check.go:467 +0x162
go/types.(*Checker).checkFiles(0xc000c14000, {0xc00149c008, 0x1, 0x1})
    /opt/hostedtoolcache/go/1.22.7/x64/src/go/types/check.go:411 +0x1cc
go/types.(*Checker).Files(...)
    /opt/hostedtoolcache/go/1.22.7/x64/src/go/types/check.go:372
golang.org/x/tools/go/packages.(*loader).loadPackage(0xc0000d60e0, 0xc001245500)
    /home/runner/go/pkg/mod/golang.org/x/tools@v0.2.0/go/packages/packages.go:1037 +0x932
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1()
    /home/runner/go/pkg/mod/golang.org/x/tools@v0.2.0/go/packages/packages.go:847 +0x1a9
sync.(*Once).doSlow(0x0?, 0x0?)
    /opt/hostedtoolcache/go/1.22.7/x64/src/sync/once.go:74 +0xc2
sync.(*Once).Do(...)
    /opt/hostedtoolcache/go/1.22.7/x64/src/sync/once.go:65
golang.org/x/tools/go/packages.(*loader).loadRecursive(0x0?, 0x0?)
    /home/runner/go/pkg/mod/golang.org/x/tools@v0.2.0/go/packages/packages.go:835 +0x4a
golang.org/x/tools/go/packages.(*loader).refine.func2(0x0?)
    /home/runner/go/pkg/mod/golang.org/x/tools@v0.2.0/go/packages/packages.go:770 +0x26
created by golang.org/x/tools/go/packages.(*loader).refine in goroutine 1
    /home/runner/go/pkg/mod/golang.org/x/tools@v0.2.0/go/packages/packages.go:769 +0xcb7
timonwong commented 3 weeks ago

I think this is addressed after 0.10.0