kisielk / errcheck

errcheck checks that you checked errors.
MIT License
2.36k stars 137 forks source link

errcheck failing on go version 1.22.0 #241

Closed onizmx closed 9 months ago

onizmx commented 9 months ago

We are currently using golang image with go version 1.22.0 in our CI.

errcheck is installed with go install github.com/kisielk/errcheck@latest and looks like it's failing as soon as go version was bumped. Pinning the image version to 1.21 fixed the problem.

Here are the error logs we got for errcheck ./... on go version 1.22.0

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

goroutine 2259 [running]:

go/types.(*Checker).handleBailout(0xc00015e200, 0xc000097c60)

    /usr/local/go/src/go/types/check.go:367 +0x88

panic({0x63a900?, 0x827370?})

    /usr/local/go/src/runtime/panic.go:770 +0x132

go/types.(*StdSizes).Sizeof(0x0, {0x6d48d8, 0x82a5a0})

    /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({0x6d48d8?, 0x82a5a0?})

    /usr/local/go/src/go/types/const.go:76 +0x9e

go/types.representableConst({0x6d5980, 0x81fef0}, 0xc00015e200, 0x82a5a0, 0xc000095e00)

    /usr/local/go/src/go/types/const.go:92 +0x192

go/types.(*Checker).representation(0xc00015e200, 0xc000c20640, 0x82a5a0)

    /usr/local/go/src/go/types/const.go:256 +0x65

go/types.(*Checker).implicitTypeAndValue(0xc00015e200, 0xc000c20640, {0x6d48d8, 0x82a5a0})

    /usr/local/go/src/go/types/expr.go:375 +0x30d

go/types.(*Checker).assignment(0xc00015e200, 0xc000c20640, {0x6d48d8, 0x82a5a0}, {0x679692, 0xe})

    /usr/local/go/src/go/types/assignments.go:52 +0x2e5

go/types.(*Checker).exprInternal(0xc00015e200, 0x0, 0xc000c20640, {0x6d4fd0, 0xc0003ad080}, {0x6d3f48, 0xc000fee690})

    /usr/local/go/src/go/types/expr.go:1175 +0x26dc

go/types.(*Checker).rawExpr(0xc00015e200, 0x0, 0xc000c20640, {0x6d4fd0?, 0xc0003ad080?}, {0x6d3f48?, 0xc000fee690?}, 0x0)

    /usr/local/go/src/go/types/expr.go:979 +0x19e

go/types.(*Checker).exprWithHint(0xc00015e200, 0xc000c20640, {0x6d4fd0, 0xc0003ad080}, {0x6d3f48, 0xc000fee690})

    /usr/local/go/src/go/types/expr.go:1563 +0x65

go/types.(*Checker).indexedElts(0xc00015e200, {0xc00015e000, 0x1b, 0xc0007a6ec0?}, {0x6d3f48, 0xc000fee690}, 0xffffffffffffffff)

    /usr/local/go/src/go/types/index.go:453 +0x129

go/types.(*Checker).exprInternal(0xc00015e200, 0x0, 0xc0003ade00, {0x6d4fd0, 0xc0003ad6c0}, {0x0, 0x0})

    /usr/local/go/src/go/types/expr.go:1247 +0x111d

go/types.(*Checker).rawExpr(0xc00015e200, 0x0, 0xc0003ade00, {0x6d4fd0?, 0xc0003ad6c0?}, {0x0?, 0x0?}, 0x0)

    /usr/local/go/src/go/types/expr.go:979 +0x19e

go/types.(*Checker).expr(0xc00015e200, 0x0?, 0xc0003ade00, {0x6d4fd0?, 0xc0003ad6c0?})

    /usr/local/go/src/go/types/expr.go:1513 +0x30

go/types.(*Checker).varDecl(0xc00015e200, 0xc00063d440, {0xc0013d0268, 0x1, 0x1}, {0x0, 0x0}, {0x6d4fd0, 0xc0003ad6c0})

    /usr/local/go/src/go/types/decl.go:521 +0x17b

go/types.(*Checker).objDecl(0xc00015e200, {0x6d7b98, 0xc00063d440}, 0x0)

    /usr/local/go/src/go/types/decl.go:194 +0x9e5

go/types.(*Checker).packageObjects(0xc00015e200)

    /usr/local/go/src/go/types/resolver.go:693 +0x4dd

go/types.(*Checker).checkFiles(0xc00015e200, {0xc0013d0180, 0x1, 0x1})

    /usr/local/go/src/go/types/check.go:408 +0x1a5

go/types.(*Checker).Files(...)

    /usr/local/go/src/go/types/check.go:372

golang.org/x/tools/go/packages.(*loader).loadPackage(0xc00014a000, 0xc000381020)

    /go/pkg/mod/golang.org/x/tools@v0.1.10/go/packages/packages.go:966 +0x76f

golang.org/x/tools/go/packages.(*loader).loadRecursive.func1()

    /go/pkg/mod/golang.org/x/tools@v0.1.10/go/packages/packages.go:803 +0x1a9

sync.(*Once).doSlow(0x6275687469672209?, 0x6c61682f6d6f632e?)

    /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(0x672209090a2c2274?, 0x6f632e6275687469?)

    /go/pkg/mod/golang.org/x/tools@v0.1.10/go/packages/packages.go:791 +0x4a

golang.org/x/tools/go/packages.(*loader).loadRecursive.func1.1(0x6b2f6f672d6e6f6d?)

    /go/pkg/mod/golang.org/x/tools@v0.1.10/go/packages/packages.go:798 +0x26

created by golang.org/x/tools/go/packages.(*loader).loadRecursive.func1 in goroutine 1509

    /go/pkg/mod/golang.org/x/tools@v0.1.10/go/packages/packages.go:797 +0x94
kisielk commented 9 months ago

This will be fixed once #240 is merged

kisielk commented 9 months ago

Should be fixed in the v1.7.0 release.