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

build: bump golang.org/x/tools v0.17.0 #211

Merged
merged 1 commit into from
Feb 11, 2024

Conversation

haunt98
Copy link
Contributor

@haunt98 haunt98 commented Feb 7, 2024

After I update to go 1.22.0, running moq is panic with runtime error: invalid memory address or nil pointer dereference.

Updating golang.org/x/tools fix the issue.

My command:

moq -out ads_mock_generated.go . AdsService

The panic:

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

goroutine 2295 [running]:
go/types.(*Checker).handleBailout(0x14000264e00, 0x1400003dbe8)
	/usr/local/go/src/go/types/check.go:367 +0x9c
panic({0x1030112c0?, 0x103240b80?})
	/usr/local/go/src/runtime/panic.go:770 +0x124
go/types.(*StdSizes).Sizeof(0x0, {0x103060238, 0x103244500})
	/usr/local/go/src/go/types/sizes.go:228 +0x320
go/types.(*Config).sizeof(...)
	/usr/local/go/src/go/types/sizes.go:333
go/types.representableConst.func1({0x103060238?, 0x103244500?})
	/usr/local/go/src/go/types/const.go:76 +0x9c
go/types.representableConst({0x103061ea8, 0x14000278ef0}, 0x14000264e00, 0x103244500, 0x0)
	/usr/local/go/src/go/types/const.go:92 +0x138
go/types.(*Checker).arrayLength(0x14000264e00, {0x1030616a8, 0x1400027b300?})
	/usr/local/go/src/go/types/typexpr.go:510 +0x238
go/types.(*Checker).typInternal(0x14000264e00, {0x1030617f8, 0x14000ec4780}, 0x0)
	/usr/local/go/src/go/types/typexpr.go:299 +0x3bc
go/types.(*Checker).definedType(0x14000264e00, {0x1030617f8, 0x14000ec4780}, 0x14000ffd3b0?)
	/usr/local/go/src/go/types/typexpr.go:180 +0x2c
go/types.(*Checker).typ(...)
	/usr/local/go/src/go/types/typexpr.go:138
go/types.(*Checker).exprInternal(0x14000264e00, 0x0, 0x14000bef740, {0x103061708, 0x140012d0900}, {0x0, 0x0})
	/usr/local/go/src/go/types/expr.go:1117 +0xc04
go/types.(*Checker).rawExpr(0x14000264e00, 0x0, 0x14000bef740, {0x103061708?, 0x140012d0900?}, {0x0?, 0x0?}, 0x0)
	/usr/local/go/src/go/types/expr.go:979 +0x12c
go/types.(*Checker).expr(0x14000264e00, 0x0?, 0x14000bef740, {0x103061708?, 0x140012d0900?})
	/usr/local/go/src/go/types/expr.go:1513 +0x38
go/types.(*Checker).varDecl(0x14000264e00, 0x140013ba000, {0x14000124758, 0x1, 0x1}, {0x0, 0x0}, {0x103061708, 0x140012d0900})
	/usr/local/go/src/go/types/decl.go:521 +0x140
go/types.(*Checker).objDecl(0x14000264e00, {0x103065498, 0x140013ba000}, 0x0)
	/usr/local/go/src/go/types/decl.go:194 +0x7ec
go/types.(*Checker).packageObjects(0x14000264e00)
	/usr/local/go/src/go/types/resolver.go:693 +0x468
go/types.(*Checker).checkFiles(0x14000264e00, {0x14000124078, 0x1,0x1})
	/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(0x140001941c0, 0x14000375020)
	/Users/anon/go/pkg/mod/golang.org/x/tools@v0.3.0/go/packages/packages.go:1037 +0x784
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1()
	/Users/anon/go/pkg/mod/golang.org/x/tools@v0.3.0/go/packages/packages.go:847 +0x178
sync.(*Once).doSlow(0x0?, 0x0?)
	/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?, 0x0?)
	/Users/anon/go/pkg/mod/golang.org/x/tools@v0.3.0/go/packages/packages.go:835 +0x50
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1.1(0x0?)
	/Users/anon/go/pkg/mod/golang.org/x/tools@v0.3.0/go/packages/packages.go:842 +0x30
created by golang.org/x/tools/go/packages.(*loader).loadRecursive.func1 in goroutine 2049
	/Users/anon/go/pkg/mod/golang.org/x/tools@v0.3.0/go/packages/packages.go:841 +0x84

So I make the PR to update golang.org/x/tools and fix #212

Again, thanks for wonderful mock tool.

@ralf-cestusio
Copy link

ralf-cestusio commented Feb 8, 2024

This is probably worth creating a Issue so that @matryer gets notified about it.

In the meantime in case anyone is stopped my this you can always do a

GOTOOLCHAIN=go1.21.7 go install github.com/matryer/moq@v0.3.3

@haunt98
Copy link
Contributor Author

haunt98 commented Feb 10, 2024

Thanks @ralf-cestusio, I open issue #212 and link to this PR.

@sudo-suhas sudo-suhas merged commit 0bf2e8a into matryer:main Feb 11, 2024
4 checks passed
@sudo-suhas
Copy link
Collaborator

Thanks @haunt98 for this fix!

@sudo-suhas
Copy link
Collaborator

Changes have been released in v0.3.4 🎉

@haunt98
Copy link
Contributor Author

haunt98 commented Feb 12, 2024

Thanks @sudo-suhas . It's my pleasure.

@haunt98 haunt98 deleted the update-go-mod branch February 12, 2024 12:52
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

Successfully merging this pull request may close these issues.

Moq panic when build with go 1.22
3 participants