Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.5.8 - panic: runtime error: invalid memory address or nil pointer dereference #101

Open
chkp-roeym opened this issue Dec 12, 2024 · 0 comments

Comments

@chkp-roeym
Copy link

I'm trying to use this useful package with version v1.5.8, as the upcoming v1.5.9 requires Go version 1.18 or higher.

using the following code:
`//go:generate go run github.com/dmarkham/enumer -type=Role -json -yaml
type Role int

const (
A Role = iota + 1
B
)
`

got the following error:
`GOROOT=/usr/local/go #gosetup
GOPATH=/Users/roeym/go #gosetup
/usr/local/go/bin/go generate -run go run github.com/dmarkham/enumer -type=Role -json -yaml
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=0x2 addr=0x0 pc=0x1008de354]

goroutine 11 [running]:
go/types.(*Checker).handleBailout(0x14000376800, 0x14000c73b98)
/usr/local/go/src/go/types/check.go:367 +0x9c
panic({0x1009d1e40?, 0x100b6ae40?})
/usr/local/go/src/runtime/panic.go:770 +0x124
go/types.(*StdSizes).Sizeof(0x0, {0x100a11a38, 0x100b6ddc0})
/usr/local/go/src/go/types/sizes.go:228 +0x314
go/types.(*Config).sizeof(...)
/usr/local/go/src/go/types/sizes.go:333
go/types.representableConst.func1({0x100a11a38?, 0x100b6ddc0?})
/usr/local/go/src/go/types/const.go:76 +0x9c
go/types.representableConst({0x100a13608, 0x100b63760}, 0x14000376800, 0x100b6ddc0, 0x14000e2db68)
/usr/local/go/src/go/types/const.go:92 +0x138
go/types.(*Checker).conversion.func1({0x100a12460?, 0x14000f02a10?}, 0x14000e2db68)
/usr/local/go/src/go/types/conversions.go:24 +0x74
go/types.(*Checker).conversion(0x14000376800, 0x14000e2db40, {0x100a12460, 0x14000f02a10})
/usr/local/go/src/go/types/conversions.go:44 +0x18c
go/types.(*Checker).callExpr(0x14000376800, 0x14000e2db40, 0x140006e8540)
/usr/local/go/src/go/types/call.go:224 +0xa54
go/types.(*Checker).exprInternal(0x14000376800, 0x0, 0x14000e2db40, {0x100a13200, 0x140006e8540}, {0x0, 0x0})
/usr/local/go/src/go/types/expr.go:1374 +0xd0
go/types.(*Checker).rawExpr(0x14000376800, 0x0, 0x14000e2db40, {0x100a13200?, 0x140006e8540?}, {0x0?, 0x0?}, 0x0)
/usr/local/go/src/go/types/expr.go:979 +0x12c
go/types.(*Checker).expr(0x14000376800, 0x14000a851a0?, 0x14000e2db40, {0x100a13200?, 0x140006e8540?})
/usr/local/go/src/go/types/expr.go:1513 +0x38
go/types.(*Checker).constDecl(0x14000376800, 0x14000a85260, {0x0, 0x0}, {0x100a13200, 0x140006e8540}, 0x0)
/usr/local/go/src/go/types/decl.go:488 +0x23c
go/types.(*Checker).objDecl(0x14000376800, {0x100a15818, 0x14000a85260}, 0x0)
/usr/local/go/src/go/types/decl.go:191 +0x84c
go/types.(*Checker).packageObjects(0x14000376800)
/usr/local/go/src/go/types/resolver.go:693 +0x468
go/types.(*Checker).checkFiles(0x14000376800, {0x140000a6240, 0x17, 0x17})
/usr/local/go/src/go/types/check.go:408 +0x164
go/types.(*Checker).Files(...)
/usr/local/go/src/go/types/check.go:372
golang.org/x/tools/go/packages.(*loader).loadPackage(0x1400014c000, 0x140004c3590)
/Users/roeym/git/saferx/saferx/vendor/golang.org/x/tools/go/packages/packages.go:1052 +0x870
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1()
/Users/roeym/git/saferx/saferx/vendor/golang.org/x/tools/go/packages/packages.go:851 +0x178
sync.(*Once).doSlow(0x100739270?, 0x1400002cc00?)
/usr/local/go/src/sync/once.go:74 +0x100
sync.(*Once).Do(...)
/usr/local/go/src/sync/once.go:65
golang.org/x/tools/go/packages.(*loader).loadRecursive(0x0?, 0x10079f084?)
/Users/roeym/git/saferx/saferx/vendor/golang.org/x/tools/go/packages/packages.go:839 +0x50
golang.org/x/tools/go/packages.(*loader).refine.func2(0x0?)
/Users/roeym/git/saferx/saferx/vendor/golang.org/x/tools/go/packages/packages.go:774 +0x30
created by golang.org/x/tools/go/packages.(*loader).refine in goroutine 1
/Users/roeym/git/saferx/saferx/vendor/golang.org/x/tools/go/packages/packages.go:773 +0xaa4
exit status 2
role.go:5: running "go": exit status 1

Process finished with exit code 1
`

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant