#5684·tinygo

hash/maphash fails to compile with Go 1.27: undefined: abi.MapType

Author: joeblew999Created Sep 15, 2026Updated Sep 17, 2026

TinyGo 0.42.0 fails to compile any program that imports hash/maphash when built with Go 1.27. The same program builds with Go 1.26.

Reproducer

go
package main

import "hash/maphash"

func main() { var h maphash.Hash; h.WriteString("x"); println(h.Sum64()) }

With Go 1.27.1:

$ tinygo build -o m.wasm -target wasm .
# internal/runtime/maps
.../go/1.27.1/src/internal/runtime/maps/group.go:298:39: undefined: abi.MapType
.../go/1.27.1/src/internal/runtime/maps/group.go:305:40: undefined: abi.MapType
.../go/1.27.1/src/internal/runtime/maps/group.go:327:25: undefined: abi.MapType
...
.../go/1.27.1/src/internal/runtime/maps/table.go:888:27: undefined: abi.MapGroupSlots
.../go/1.27.1/src/internal/runtime/maps/table.go:1032:32: undefined: abi.MapGroupSlotsBits
  • Go 1.26.8, tinygo build -target wasm: builds

  • Go 1.27.1, tinygo build -target wasm: fails as above

  • Go 1.27.1, tinygo build (native): fails the same way

  • Go 1.27.1, go run: works

  • tinygo version 0.42.0 darwin/arm64 (using go version go1.27.1 and LLVM version 22.1.4)

  • internal/abi on dev still has only abi.go, escape.go, funcpc.go and type.go (checked 2026-09-15)

Cause

In Go 1.26, hash/maphash was split by build tag:

  • maphash_runtime.go (//go:build !purego) imports internal/runtime/maps
  • maphash_purego.go (//go:build purego) does not

TinyGo builds with the purego tag, so it used the pure Go version.

Go 1.27 removed that split. maphash.go now imports internal/runtime/maps for every build, and the purego file is gone. That package needs abi.MapType, abi.MapGroupSlots and abi.MapGroupSlotsBits, which TinyGo's internal/abi doesn't define.

TinyGo overrides runtime, reflect and unique, but not hash/maphash, so the Go 1.27 version is used as-is.

Impact

Anything that imports hash/maphash, directly or through a dependency, stops compiling on Go 1.27. We hit it through github.com/modelcontextprotocol/go-sdkgithub.com/google/jsonschema-go (used for uniqueItems validation), while building a Cloudflare Worker with syumai/workers-go. The Worker build doesn't compile with TinyGo unless MCP is compiled out.

Possible fixes

  • Provide a TinyGo version of hash/maphash in src/hash/maphash, as is already done for unique and reflect. It would be based on the 1.26 maphash_purego.go and not use internal/runtime/maps.
  • Or add the Go 1.27 map types to TinyGo's internal/abi so internal/runtime/maps compiles. This is probably the larger change.