ServiceWeaver / weaver

Programming framework for writing and deploying cloud applications.
https://serviceweaver.dev
Apache License 2.0
4.81k stars 243 forks source link

[Question] Weaver generate error in go/type.(*Checker) #768

Closed renanbastos93 closed 4 weeks ago

renanbastos93 commented 6 months ago

Anyone has had it problem? I executed weaver generate ./... Weaver version: v0.22.0 (binary/cli and go.mod) Go version: v1.22


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

goroutine 68 [running]:
go/types.(*Checker).handleBailout(0xc0001bf200, 0xc000ad9bd0)
        /usr/local/go/src/go/types/check.go:367 +0x88
panic({0xf1e840?, 0x1987080?})
        /usr/local/go/src/runtime/panic.go:770 +0x132
go/types.(*StdSizes).Sizeof(0x0, {0x11f04c0, 0x199b920})
        /usr/local/go/src/go/types/sizes.go:228 +0x30f
go/types.(*Config).sizeof(...)
        /usr/local/go/src/go/types/sizes.go:333
go/types.representableConst.func1({0x11f04c0?, 0x199b920?})
        /usr/local/go/src/go/types/const.go:76 +0x9e
go/types.representableConst({0x11f5ab0, 0x1952280}, 0xc0001bf200, 0x199b920, 0xc000ad7fe8)
        /usr/local/go/src/go/types/const.go:92 +0x192
go/types.(*Checker).representation(0xc0001bf200, 0xc000a9c440, 0x199b920)
        /usr/local/go/src/go/types/const.go:256 +0x65
go/types.(*Checker).implicitTypeAndValue(0xc0001bf200, 0xc000a9c440, {0x11f04c0, 0x199b920})
        /usr/local/go/src/go/types/expr.go:375 +0x2d7
go/types.(*Checker).convertUntyped(0xc0001bf200, 0xc000a9c440, {0x11f04c0, 0x199b920})
        /usr/local/go/src/go/types/const.go:289 +0x3f
go/types.(*Checker).matchTypes(0xc0001bf200, 0xc000a9c400, 0xc000a9c440)
        /usr/local/go/src/go/types/expr.go:926 +0x79
go/types.(*Checker).binary(0xc0001bf200, 0xc000a9c400, {0x11f39b8, 0xc000f74270}, {0x11f39e8, 0xc000f76200}, {0x11f3ec8, 0xc000145ba0}, 0x27, 0x6054b)
        /usr/local/go/src/go/types/expr.go:800 +0x166
go/types.(*Checker).exprInternal(0xc0001bf200, 0x0, 0xc000a9c400, {0x11f39b8, 0xc000f74270}, {0x0, 0x0})
        /usr/local/go/src/go/types/expr.go:1416 +0x206
go/types.(*Checker).rawExpr(0xc0001bf200, 0x0, 0xc000a9c400, {0x11f39b8?, 0xc000f74270?}, {0x0?, 0x0?}, 0x0)
        /usr/local/go/src/go/types/expr.go:979 +0x19e
go/types.(*Checker).expr(0xc0001bf200, 0x11f0dc8?, 0xc000a9c400, {0x11f39b8?, 0xc000f74270?})
        /usr/local/go/src/go/types/expr.go:1513 +0x30
go/types.(*Checker).stmt(0xc0001bf200, 0x0, {0x11f3b68, 0xc000f76240})
        /usr/local/go/src/go/types/stmt.go:570 +0x11f2
go/types.(*Checker).stmtList(0xc0001bf200, 0x0, {0xc000aa0080?, 0x0?, 0x0?})
        /usr/local/go/src/go/types/stmt.go:121 +0x85
go/types.(*Checker).funcBody(0xc0001bf200, 0x11f0560?, {0xc000c007e0?, 0xc000c1a300?}, 0xc000a9c280, 0xc0009c4d50, {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(0xc0001bf200, 0x0)
        /usr/local/go/src/go/types/check.go:467 +0x162
go/types.(*Checker).checkFiles(0xc0001bf200, {0xc000f129a0, 0x1, 0x1})
        /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(0xc000432000, 0xc000970150)
        /home/salvador/go/pkg/mod/golang.org/x/tools@v0.11.0/go/packages/packages.go:1055 +0xa72
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1()
        /home/salvador/go/pkg/mod/golang.org/x/tools@v0.11.0/go/packages/packages.go:854 +0x1a9
sync.(*Once).doSlow(0x0?, 0x0?)
        /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(0x0?, 0x0?)
        /home/salvador/go/pkg/mod/golang.org/x/tools@v0.11.0/go/packages/packages.go:842 +0x4a
golang.org/x/tools/go/packages.(*loader).refine.func2(0x0?)
        /home/salvador/go/pkg/mod/golang.org/x/tools@v0.11.0/go/packages/packages.go:777 +0x26
created by golang.org/x/tools/go/packages.(*loader).refine in goroutine 1
        /home/salvador/go/pkg/mod/golang.org/x/tools@v0.11.0/go/packages/packages.go:776 +0xccf```
rgrandl commented 6 months ago

I have go 1.23 and weaver 0.24.2 and it works fine.

renanbastos93 commented 6 months ago

This error occurs on WSL Windows with Ubuntu. This computer is from my workmate but I believe it's a corrupt Golang.