atc0005 / go-ci

Tooling for linting, testing and building Go applications

Home Page:https://hub.docker.com/r/atc0005/go-ci

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`orijtech/structslop` linter failing on Go 1.22rc2 with `runtime error: invalid memory address or nil pointer dereference` error

atc0005 opened this issue · comments

Overview

The structslop linter is failing to execute in Go 1.22rc2 unstable images.

Output from a recent CI run:

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=0x59997e]

goroutine 10 [running]:
go/types.(*Checker).handleBailout(0xc0001d0c00, 0xc0001dbbd0)
	/usr/local/go/src/go/types/check.go:367 +0x88
panic({0x765060?, 0xa0cbc0?})
	/usr/local/go/src/runtime/panic.go:770 +0x132
go/types.(*StdSizes).Sizeof(0x0, {0x8420e8, 0xa13640})
	/usr/local/go/src/go/types/sizes.go:228 +0x31e
go/types.(*Config).sizeof(...)
	/usr/local/go/src/go/types/sizes.go:333
go/types.representableConst.func1({0x8420e8?, 0xa13640?})
	/usr/local/go/src/go/types/const.go:76 +0x9e
go/types.representableConst({0x8440f0, 0xa05420}, 0xc0001d0c00, 0xa13640, 0xc0001d94a0)
	/usr/local/go/src/go/types/const.go:92 +0x192
go/types.(*Checker).representation(0xc0001d0c00, 0xc0001abc80, 0xa13640)
	/usr/local/go/src/go/types/const.go:256 +0x65
go/types.(*Checker).implicitTypeAndValue(0xc0001d0c00, 0xc0001abc80, {0x8420e8, 0xa13640})
	/usr/local/go/src/go/types/expr.go:375 +0x30d
go/types.(*Checker).assignment(0xc0001d0c00, 0xc0001abc80, {0x8420e8, 0xa13640}, {0xc000442468, 0x13})
	/usr/local/go/src/go/types/assignments.go:52 +0x2e5
go/types.(*Checker).arguments(0xc0001d0c00, 0xc0005a3400, 0xc000361100, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, {0xc0007179b0, ...}, ...)
	/usr/local/go/src/go/types/call.go:654 +0x13dc
go/types.(*Checker).callExpr(0xc0001d0c00, 0xc0001abbc0, 0xc0005a3400)
	/usr/local/go/src/go/types/call.go:304 +0x6e9
go/types.(*Checker).exprInternal(0xc0001d0c00, 0x0, 0xc0001abbc0, {0x843aa8, 0xc0005a3400}, {0x0, 0x0})
	/usr/local/go/src/go/types/expr.go:1374 +0xf8
go/types.(*Checker).rawExpr(0xc0001d0c00, 0x0, 0xc0001abbc0, {0x843aa8?, 0xc0005a3400?}, {0x0?, 0x0?}, 0x0)
	/usr/local/go/src/go/types/expr.go:979 +0x19e
go/types.(*Checker).multiExpr(0xc0001d0c00, {0x843aa8, 0xc0005a3400}, 0x0)
	/usr/local/go/src/go/types/expr.go:1532 +0x79
go/types.(*Checker).assignVars(0xc0001d0c00, {0xc0001ba450, 0x1, 0x1}, {0xc0001ba470, 0x1, 0x1})
	/usr/local/go/src/go/types/assignments.go:472 +0xd0
go/types.(*Checker).stmt(0xc0001d0c00, 0x0, {0x843658, 0xc0005a3440})
	/usr/local/go/src/go/types/stmt.go:476 +0x1628
go/types.(*Checker).stmtList(0xc0001d0c00, 0x0, {0xc000022500?, 0xc0001db988?, 0x45273e?})
	/usr/local/go/src/go/types/stmt.go:121 +0x85
go/types.(*Checker).funcBody(0xc0001d0c00, 0x8424a8?, {0xc0002800a4?, 0xc0003e6320?}, 0xc0001aa4c0, 0xc0005ae630, {0x0?, 0x0?})
	/usr/local/go/src/go/types/stmt.go:41 +0x331
go/types.(*Checker).funcDecl.func1()
	/usr/local/go/src/go/types/decl.go:852 +0x3a
go/types.(*Checker).processDelayed(0xc0001d0c00, 0x0)
	/usr/local/go/src/go/types/check.go:467 +0x162
go/types.(*Checker).checkFiles(0xc0001d0c00, {0xc000215638, 0x3, 0x3})
	/usr/local/go/src/go/types/check.go:411 +0x1cc
go/types.(*Checker).Files(...)
	/usr/local/go/src/go/types/check.go:372
golang.org/x/tools/go/packages.(*loader).loadPackage(0xc000116000, 0xc000452150)
	/go/pkg/mod/golang.org/x/tools@v0.8.0/go/packages/packages.go:1052 +0xa72
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1()
	/go/pkg/mod/golang.org/x/tools@v0.8.0/go/packages/packages.go:851 +0x1a9
sync.(*Once).doSlow(0xc000052f98?, 0x405ff7?)
	/usr/local/go/src/sync/once.go:74 +0xc2
sync.(*Once).Do(...)
	/usr/local/go/src/sync/once.go:65
golang.org/x/tools/go/packages.(*loader).loadRecursive(0x65d23e?, 0xc000052fd0?)
	/go/pkg/mod/golang.org/x/tools@v0.8.0/go/packages/packages.go:839 +0x4a
golang.org/x/tools/go/packages.(*loader).refine.func2(0x0?)
	/go/pkg/mod/golang.org/x/tools@v0.8.0/go/packages/packages.go:774 +0x26
created by golang.org/x/tools/go/packages.(*loader).refine in goroutine 1
	/go/pkg/mod/golang.org/x/tools@v0.8.0/go/packages/packages.go:773 +0xccf

The linter appears to still execute properly from earlier Go images.

References

As before, the fix appears to be updating the dependencies used by the orijtech/structslop project.

I've submitted a PR for that purpose:

For the time being, I may want to replace the use of the upstream provided binary with one provided by my fork.