Skip to content

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

@berkayburakk

Description

@berkayburakk

Summary

When running go-mutesting on a Go 1.21+ project, the tool panics with a nil pointer dereference due to an uninitialized Sizes field in go/types.Config.

Steps to Reproduce

  1. Use Go 1.21 or 1.22
  2. Install and run go-mutesting:
    go-mutesting ./...
    

panic: runtime error: invalid memory address or nil pointer dereference
go/types.(*StdSizes).Sizeof(0x0, ...)

Root Cause

In analyzer/analyzer.go, the types.Config struct is instantiated without setting the Sizes field:

Suggested Fix

Set the Sizes field using the appropriate call:

    Importer: importer,
    Sizes:    types.SizesFor("gc", build.Default.GOARCH),
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions