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
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-sdk → github.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.
TinyGo 0.42.0 fails to compile any program that imports
hash/maphashwhen built with Go 1.27. The same program builds with Go 1.26.Reproducer
With Go 1.27.1:
Go 1.26.8,
tinygo build -target wasm: buildsGo 1.27.1,
tinygo build -target wasm: fails as aboveGo 1.27.1,
tinygo build(native): fails the same wayGo 1.27.1,
go run: workstinygo version 0.42.0 darwin/arm64 (using go version go1.27.1 and LLVM version 22.1.4)
internal/abiondevstill has onlyabi.go,escape.go,funcpc.goandtype.go(checked 2026-09-15)Cause
In Go 1.26,
hash/maphashwas split by build tag:maphash_runtime.go(//go:build !purego) importsinternal/runtime/mapsmaphash_purego.go(//go:build purego) does notTinyGo builds with the
puregotag, so it used the pure Go version.Go 1.27 removed that split.
maphash.gonow importsinternal/runtime/mapsfor every build, and thepuregofile is gone. That package needsabi.MapType,abi.MapGroupSlotsandabi.MapGroupSlotsBits, which TinyGo'sinternal/abidoesn't define.TinyGo overrides
runtime,reflectandunique, but nothash/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 throughgithub.com/modelcontextprotocol/go-sdk→github.com/google/jsonschema-go(used foruniqueItemsvalidation), while building a Cloudflare Worker with syumai/workers-go. The Worker build doesn't compile with TinyGo unless MCP is compiled out.Possible fixes
hash/maphashinsrc/hash/maphash, as is already done foruniqueandreflect. It would be based on the 1.26maphash_purego.goand not useinternal/runtime/maps.internal/abisointernal/runtime/mapscompiles. This is probably the larger change.