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

panic: runtime error: invalid memory address or nil pointer dereference #59

Open
1 of 2 tasks
graywolf-s1 opened this issue Nov 12, 2024 · 0 comments
Open
1 of 2 tasks

Comments

@graywolf-s1
Copy link

Before submitting an issue, please make sure:

  • You're running Go 1.6 or later
  • You've tried installing with go get -u to update dependencies

If you see the following error, you need to update to Go 1.6+:

$ go get github.com/zmb3/gogetdoc
# github.com/zmb3/gogetdoc
./ident.go:142: c.Val().ExactString undefined (type constant.Value has no field or method ExactString)

Hello,

when I try to run the example from the readme, the gogetdoc panics:

$ go install github.com/zmb3/gogetdoc@latest
$ ~/go/bin/gogetdoc -pos "$(go env GOROOT)/src/fmt/format.go:#2351"
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=0x1051c7d74]

goroutine 12 [running]:
go/types.(*Checker).handleBailout(0x14000083500, 0x140001a5c98)
	/opt/local/lib/go/src/go/types/check.go:404 +0x9c
panic({0x105338760?, 0x10554da80?})
	/opt/local/lib/go/src/runtime/panic.go:785 +0x124
go/types.(*StdSizes).Sizeof(0x0, {0x105383be8, 0x1055512c0})
	/opt/local/lib/go/src/go/types/sizes.go:229 +0x314
go/types.(*Config).sizeof(...)
	/opt/local/lib/go/src/go/types/sizes.go:334
go/types.representableConst.func1({0x105383be8?, 0x1055512c0?})
	/opt/local/lib/go/src/go/types/const.go:77 +0x90
go/types.representableConst({0x105385458, 0x105544fd8}, 0x14000083500, 0x1055512c0, 0x140001a49d8)
	/opt/local/lib/go/src/go/types/const.go:107 +0x2ac
go/types.(*Checker).representation(0x14000083500, 0x140004cd000, 0x1055512c0)
	/opt/local/lib/go/src/go/types/const.go:257 +0x68
go/types.(*Checker).representable(0x14000083500, 0x140004cd000, 0x1055512c0)
	/opt/local/lib/go/src/go/types/const.go:240 +0x28
go/types.(*Checker).shift(0x14000083500, 0x140004ccf80, 0x140004cd000, {0x105384ad8, 0x140000a8060}, 0x14)
	/opt/local/lib/go/src/go/types/expr.go:652 +0x1d4
go/types.(*Checker).binary(0x14000083500, 0x140004ccf80, {0x105384ad8, 0x140000a8060}, {0x105384fe8, 0x14000092580}, {0x105384fe8, 0x140000925a0}, 0x14, 0x1c4a)
	/opt/local/lib/go/src/go/types/expr.go:798 +0x100
go/types.(*Checker).exprInternal(0x14000083500, 0x0, 0x140004ccf80, {0x105384ad8, 0x140000a8060}, {0x0, 0x0})
	/opt/local/lib/go/src/go/types/expr.go:1452 +0x1d4
go/types.(*Checker).rawExpr(0x14000083500, 0x0, 0x140004ccf80, {0x105384ad8?, 0x140000a8060?}, {0x0?, 0x0?}, 0x0)
	/opt/local/lib/go/src/go/types/expr.go:981 +0x120
go/types.(*Checker).expr(0x14000083500, 0x0?, 0x140004ccf80, {0x105384ad8?, 0x140000a8060?})
	/opt/local/lib/go/src/go/types/expr.go:1549 +0x38
go/types.(*Checker).binary(0x14000083500, 0x140004ccf80, {0x105384ad8, 0x140000a8090}, {0x105384ad8, 0x140000a8060}, {0x105384fe8, 0x140000925c0}, 0xd, 0x1c4e)
	/opt/local/lib/go/src/go/types/expr.go:785 +0x70
go/types.(*Checker).exprInternal(0x14000083500, 0x0, 0x140004ccf80, {0x105384ad8, 0x140000a8090}, {0x0, 0x0})
	/opt/local/lib/go/src/go/types/expr.go:1452 +0x1d4
go/types.(*Checker).rawExpr(0x14000083500, 0x0, 0x140004ccf80, {0x105384ad8?, 0x140000a8090?}, {0x0?, 0x0?}, 0x0)
	/opt/local/lib/go/src/go/types/expr.go:981 +0x120
go/types.(*Checker).expr(0x14000083500, 0x105197f68?, 0x140004ccf80, {0x105384ad8?, 0x140000a8090?})
	/opt/local/lib/go/src/go/types/expr.go:1549 +0x38
go/types.(*Checker).constDecl(0x14000083500, 0x14000095260, {0x0, 0x0}, {0x105384ad8, 0x140000a8090}, 0x0)
	/opt/local/lib/go/src/go/types/decl.go:480 +0x228
go/types.(*Checker).objDecl(0x14000083500, {0x105388958, 0x14000095260}, 0x0)
	/opt/local/lib/go/src/go/types/decl.go:185 +0x840
go/types.(*Checker).packageObjects(0x14000083500)
	/opt/local/lib/go/src/go/types/resolver.go:714 +0x3f0
go/types.(*Checker).checkFiles(0x14000083500, {0x140000a6000, 0x1, 0x1})
	/opt/local/lib/go/src/go/types/check.go:459 +0x190
go/types.(*Checker).Files(0x1400013a460?, {0x140000a6000?, 0x140000941e0?, 0x4?})
	/opt/local/lib/go/src/go/types/check.go:422 +0x80
golang.org/x/tools/go/packages.(*loader).loadPackage(0x1400013a460, 0x140002e2b00)
	/Users/user/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:711 +0x488
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1()
	/Users/user/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:571 +0x178
sync.(*Once).doSlow(0x0?, 0x0?)
	/opt/local/lib/go/src/sync/once.go:76 +0xf8
sync.(*Once).Do(...)
	/opt/local/lib/go/src/sync/once.go:67
golang.org/x/tools/go/packages.(*loader).loadRecursive(0x0?, 0x0?)
	/Users/user/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:558 +0x48
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1.1(0x0?)
	/Users/user/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:565 +0x30
created by golang.org/x/tools/go/packages.(*loader).loadRecursive.func1 in goroutine 8
	/Users/user/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:564 +0x84
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=0x1051c7d74]

goroutine 84 [running]:
go/types.(*Checker).handleBailout(0x14000632540, 0x1400053dc98)
	/opt/local/lib/go/src/go/types/check.go:404 +0x9c
panic({0x105338760?, 0x10554da80?})
	/opt/local/lib/go/src/runtime/panic.go:785 +0x124
go/types.(*StdSizes).Sizeof(0x0, {0x105383be8, 0x105551220})
	/opt/local/lib/go/src/go/types/sizes.go:229 +0x314
go/types.(*Config).sizeof(...)
	/opt/local/lib/go/src/go/types/sizes.go:334
go/types.representableConst.func1({0x105383be8?, 0x105551220?})
	/opt/local/lib/go/src/go/types/const.go:77 +0x90
go/types.representableConst({0x105385458, 0x105545020}, 0x14000632540, 0x105551220, 0x0)
	/opt/local/lib/go/src/go/types/const.go:93 +0x134
go/types.(*Checker).arrayLength(0x14000632540, {0x105384fe8, 0x1400063c160?})
	/opt/local/lib/go/src/go/types/typexpr.go:537 +0x1bc
go/types.(*Checker).typInternal(0x14000632540, {0x1053848f8, 0x1400061c780}, 0x0)
	/opt/local/lib/go/src/go/types/typexpr.go:320 +0x3b0
go/types.(*Checker).definedType(0x14000632540, {0x1053848f8, 0x1400061c780}, 0x1400053d4a0?)
	/opt/local/lib/go/src/go/types/typexpr.go:201 +0x28
go/types.(*Checker).varType(0x14000632540, {0x1053848f8, 0x1400061c780})
	/opt/local/lib/go/src/go/types/typexpr.go:166 +0x2c
go/types.(*Checker).structType(0x14000632540, 0x1400061d140, 0x1400061d140?)
	/opt/local/lib/go/src/go/types/struct.go:114 +0x11c
go/types.(*Checker).typInternal(0x14000632540, {0x105384778, 0x1400060a2e8}, 0x14000646870)
	/opt/local/lib/go/src/go/types/typexpr.go:337 +0xc20
go/types.(*Checker).definedType(0x14000632540, {0x105384778, 0x1400060a2e8}, 0x105051c54?)
	/opt/local/lib/go/src/go/types/typexpr.go:201 +0x28
go/types.(*Checker).typeDecl(0x14000632540, 0x14000646870, 0x14000644080, 0x0)
	/opt/local/lib/go/src/go/types/decl.go:649 +0x454
go/types.(*Checker).objDecl(0x14000632540, {0x1053889f8, 0x14000646870}, 0x0)
	/opt/local/lib/go/src/go/types/decl.go:191 +0x874
go/types.(*Checker).packageObjects(0x14000632540)
	/opt/local/lib/go/src/go/types/resolver.go:702 +0x350
go/types.(*Checker).checkFiles(0x14000632540, {0x14000428020, 0x1, 0x1})
	/opt/local/lib/go/src/go/types/check.go:459 +0x190
go/types.(*Checker).Files(0x1400013a460?, {0x14000428020?, 0x1400041a900?, 0x5?})
	/opt/local/lib/go/src/go/types/check.go:422 +0x80
golang.org/x/tools/go/packages.(*loader).loadPackage(0x1400013a460, 0x140002e28a0)
	/Users/user/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:711 +0x488
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1()
	/Users/user/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:571 +0x178
sync.(*Once).doSlow(0x0?, 0x0?)
	/opt/local/lib/go/src/sync/once.go:76 +0xf8
sync.(*Once).Do(...)
	/opt/local/lib/go/src/sync/once.go:67
golang.org/x/tools/go/packages.(*loader).loadRecursive(0x0?, 0x0?)
	/Users/user/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:558 +0x48
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1.1(0x0?)
	/Users/user/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:565 +0x30
created by golang.org/x/tools/go/packages.(*loader).loadRecursive.func1 in goroutine 65
	/Users/user/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:564 +0x84

My golang version:

$ go version
go version go1.23.3 darwin/arm64

And os:

$ uname -a
Darwin host 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6030 arm64 arm Darwin
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