Skip to main content

MEP-74 research bundle

This bundle is the informative companion to MEP-74. It documents the design space the Go bridge sits in: prior art, the choices considered and rejected, the trade-offs accepted, and the open risks. The bundle is meant to be read alongside the spec, not in place of it.

Notes

NoteSubject
01. Language surfaceThe import go "<module>@<semver>" as <alias> import shape, the mochi.toml [go-dependencies] + [go] tables, the CLI surface (mochi pkg add go, mochi pkg publish --to=go+git+...), and the per-import alias semantics.
02. Design philosophyWhy a bidirectional bridge, why go/packages over alternatives, why a synthesised cgo wrapper package over direct cgo invocation, why no async runtime singleton is needed for Go, why sum.golang.org cross-check is mandatory by default.
03. Prior-art bridgesgopy, gomobile bind, gobind, swig, c-shared / c-archive build modes, purego, wazero, JNA / JNI Go variants, dotnet-go. What each gets right, what each requires the user to write, and what MEP-74 borrows.
04. go/packages + go/types ingestThe go/packages.Load flow, the types.Type discriminator tree, the stability story, why no nightly toolchain is needed, the Go-side helper binary shape.
05. Type mapping tableThe complete closed translation table, the refusal cases, the generic monomorphisation rule, the string vs []byte parameter handling, the error desugar, the chan and func mappings.
06. Go module publish flowThe git-tag upload protocol, the canonical-import-path requirement, the module proxy's caching behaviour, the per-module metadata requirements, the publish-side gate.
07. Sigstore and Go checksum DBThe sum.golang.org transparency log, the Merkle-tree consistency proof, the gosum-cosign workflow draft, the optional <tag>.sig sibling tag, the verification path at consume time.
08. Goroutine bridgeThe cgo boundary cost, the goroutine scheduler inside the c-archive, the channel-as-handle pattern, the callback-as-handle pattern, the cgo.Handle lifetime story.
09. ABI stabilityThe cgo //export ABI, the C-side ownership contract, the runtime.KeepAlive invariant, the string and slice round-trip, the c-archive vs c-shared decision, the cross-platform header story.
10. Interfaces and method setsGo's structural interface satisfaction, the method-set rules (value vs pointer receiver), how the bridge translates type I interface { M() } into Mochi extern types, the trait-object analogue.
11. TinyGo and embeddedThe TinyGo subset of pkg.go.dev, the no-cgo embedded path, the wasm-js and wasm-wasip1 surface, what kind of Go modules Mochi can consume on bare metal.
12. Risks and alternativesThe risk register (cgo cost, GC interaction, generic explosion, proxy compromise, sumdb single-key trust) and the rejected alternatives (parse source directly, pkg.go.dev HTML, gomobile bind, plugin build mode, protobuf bridge, scheduler reimplementation).

Cross-references

  • MEP-74 spec — the normative document.
  • MEP-54 — the Go transpiler this bridge builds on.
  • MEP-57 — the source-level package system whose manifest and lockfile the bridge extends.
  • MEP-73 — the sister Rust bridge whose spec template MEP-74 mirrors.
  • Implementation tracking — the per-phase delivery status.