Skip to content

compilation error: undefined: GoMapIterator with Go 1.25.1 #858

@welkeyever

Description

@welkeyever

Environment

  • Go Version: go version go1.25.1 darwin/amd64
  • Sonic Version: v1.13.3
  • OS: macOS

Steps to Reproduce

  1. Create a new Go project.
  2. Add github.com/bytedance/[email protected] as a dependency.
  3. Use the following code in main.go:
package main

import (
	"fmt"
	"github.com/bytedance/sonic"
)

type Test struct {
	A string
	B int
}

func main() {
	t := Test{A: "hello", B: 1}
	b, err := sonic.MarshalString(t)
	if err != nil {
		panic(err)
	}
	fmt.Println(b)
}
  1. Run the program using go run ..

Expected Behavior

The program should compile and run successfully, printing the JSON representation of the Test struct.

Actual Behavior

The compilation fails with the following error:

# github.com/bytedance/sonic/internal/rt
../../../../go/pkg/mod/github.com/bytedance/[email protected]/internal/rt/stubs.go:33:22: undefined: GoMapIterator
../../../../go/pkg/mod/github.com/bytedance/[email protected]/internal/rt/stubs.go:36:54: undefined: GoMapIterator

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions