Skip to content

fix: set types.Config.Sizes to prevent nil pointer panic on Go 1.21+#49

Open
jonbaldie wants to merge 2 commits into
avito-tech:masterfrom
jonbaldie:fix/types-config-sizes
Open

fix: set types.Config.Sizes to prevent nil pointer panic on Go 1.21+#49
jonbaldie wants to merge 2 commits into
avito-tech:masterfrom
jonbaldie:fix/types-config-sizes

Conversation

@jonbaldie
Copy link
Copy Markdown

Go 1.21+ requires types.Config.Sizes to be set; without it, go/types.(*StdSizes).Sizeof dereferences a nil pointer and crashes go-mutesting immediately, which is the root cause described in #37 and reported again in #44.

Closes #37.

jonbaldie and others added 2 commits May 14, 2026 11:40
Without Sizes set in the loader's TypeChecker, go/types.(*StdSizes).Sizeof
dereferences a nil pointer on Go 1.21 and later, crashing go-mutesting
immediately on any project.

Closes avito-tech#37.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
types.SizesFor returns nil for unrecognised compiler/arch combinations;
setting Sizes to nil would reproduce the same crash we are trying to
prevent, so the value is only assigned when it is non-nil.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

panic: runtime error due to missing Config.Sizes field in go/types.Config

1 participant