The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
v0.7.0 — 2025-05-25
- Removed remaining Go 1.22 support.
- #306: do not emit incompatible version feature gates when serializing WIT. For example, if a world with version
0.1.0includes a world from another package with a@since(version = 0.2.0)feature gate, then strip that feature gate when serializing to WIT if the version is greater than the world’s package version. - #350: correctly align
recordsize to the highest alignment of its fields, per specification. - #352: do not use
tupletypes as data shape forvariantorresulttypes, as they may contain aboolor not be packed. - #356: sort WIT packages topologically by dependency before matching WIT world when generating Go bindings. Warn if there is an ambiguous match.
- Updated package
cmto v0.3.0 with multiple fixes, including a breaking change tocm.BoolResult.
v0.6.2 — 2025-03-16
- Files generated by
wit-bindgen-go generateno longer have the execute bit set. - Updated package
cmto v0.2.2 with error handling fixes.
v0.6.1 — 2025-03-16
- Updated package
cmto v0.2.1 with JSON fixes.
v0.6.0 — 2025-03-15
- Initial support for Component Model async types
stream,future, anderror-context. - Initial support for JSON serialization of WIT
list,enum, andrecordtypes. wasm-toolsis now vendored as a WebAssembly module, executed using Wazero. This allows packagewitandwit-bindgen-goto run on any supported platform without needing to separately installwasm-tools.
- Breaking: generated
*.wasm.gofiles will now have correct WIT kebab-case base name. Interfaces or worlds with-in their name will require removal of the previous*.wasm.gofiles. - Breaking: upgraded to
wasm-toolsv1.227.1, which removes support for multiple return values and flags with > 32 values. To ease migration, this package will continue to support JSON generated bywasm-toolsv1.225.0 and earlier. - Dropped support for TinyGo v0.32.0 and v0.33.0.
- Added support for Go 1.24 and dropped support for Go 1.22.
- #281: errors from internal
wasm-toolscalls are no longer silently ignored. This required fixing a number of related issues, including synthetic world packages for Component Model metadata generation, WIT generation, and WIT keyword escaping in WIT package or interface names. - #284: do not use
boolforvariantorresultGC shapes. TinyGo returnsresultandvariantvalues withboolas 0 or 1, which breaks the memory representation of tagged unions (variants). - #288: correctly report the
wasm32ABI alignment oflist<T>as 4, rather than 8. - #306: run
wasm-toolswith the--all-featuresargument so feature-gated WIT is correctly found when synthesizing Component Model metadata for a Go package.
v0.5.0 — 2024-12-14
- Breaking: package
cmis now a separate module. This change was made in order to minimize the runtime dependencies of programs that depend on packagecmbut not the rest of the packages in this module. To update your code that depends on packagecm, rungo get -u go.bytecodealliance.org/....
- #264: fix lowering for imported functions that return named
booltypes.
v0.4.1 — 2024-12-09
wit-bindgen-go witnow accepts an--interfaceargument in the form ofmonotonic-clock,wasi:clocks/monotonic-clock, orwasi:clocks/monotonic-clock@0.2.0. This filters the serialized WIT to a specific interface and the other interface(s) it references. This can be used to generate focused WIT with a minimal set of dependencies, and can be combined with the--worldargument to filter serialized WIT to the intersection of a specific world and interface.
- Breaking: package
witno longer interprets-to read from stdin when loading JSON or WIT usingwit.LoadJSONorwit.LoadWIT. Usewit.DecodeJSONorwit.DecodeWITto read JSON or WIT from anio.Reader. - Breaking:
wit.ParseWIThas been removed. Usewit.DecodeWIT(bytes.NewReader(b))instead.
- #240: correctly handle cyclical data structures when generating variant lowering code.
v0.4.0 — 2024-11-05
This module has been renamed. Going forward, please use go.bytecodealliance.org instead of github.com/bytecodealliance/wasm-tools-go.
v0.3.1 — 2024-11-01
wit-bindgen-gonow accepts arguments that control the level of logging output on stderr. Verbose mode (-vor--verbose) will print informational log lines, warnings, and errors. Debug mode (-vvor--debug) will emit finer-grained debugging information. By default,wit-bindgen-gowill print warnings or errors.- New method
(cm.Result).Result() (ok OK, err Err, isErr bool)added to streamline common patterns usingresulttypes. It has a value receiver, allowing it to be chained off a function call that returns aResult, eliminating the need to declare a temporary variable. For example:stream, err, isErr := stream.BlockingRead(n)
- #215: generate variant accessor methods with the correct scope for Go names.
- @vados-cosmonic: #212 and #214 — verbose logging controls in
wit-bindgen-go.
v0.3.0 — 2024-10-11
- Go type aliases are now generated for each WIT type alias (
type foo = bar). Deep chains of type aliases (type b = a; type c = b;) are fully supported. Generated documentation now reflects whether a type is an alias. Fixes #204. go:wasmimportandgo:wasmexportfunctions are now generated in a separate.wasm.gofile. This helps enable testing or use of generated packages outside of WebAssembly.wit-bindgen-go generatenow generates a WIT file for each WIT world in its corresponding Go package directory. For example thewasi:http/proxyworld would generatewasi/http/proxy/proxy.wit.wit-bindgen-go witnow accepts a--worldargument in the form ofimports,wasi:clocks/imports, orwasi:clocks/imports@0.2.0. This filters the serialized WIT to a specific world and interfaces it references. This can be used to generate focused WIT for a specific world with a minimal set of dependencies.
- Method
wit.(*Package).WIT()now interprets the non-empty stringnameargument as signal to render in single-file, multi-package braced form. wit.(*Resolve).WIT()andwit.(*Package).WIT()now accept a*wit.Worldas context to filter serialized WIT to a specific world.- Packages are now sorted topologically by dependency in generated WIT files. For example,
wasi:cliwould be followed by its dependencies likewasi:io,wasi:filesystem, orwasi:random.
v0.2.4 — 2024-10-06
- Generated variant shape types (
...Shape) now includestructs.HostLayout.
v0.2.3 — 2024-10-05
wit-bindgen-go generatenow accepts a remote registry reference to pull down a WIT package and generate the Go code. Example:wit-bindgen-go generate ghcr.io/webassembly/wasi/http:0.2.0.
cm.Listnow stores list length as auintptr, permitted by the Go wasm types proposal. It was previously auint, which was removed from the list of permitted types. There should be no change in the memory layout in TinyGoGOARCH=wasmor GoGOARCH=wasm32using 32-bit pointers.- The helper functions
cm.NewList,cm.LiftList, andcm.LiftStringnow accept any integer type forlen, defined ascm.AnyInteger. cm.Option[T].Value()method now value receiver (not pointer receiver), so it can be chained.
v0.2.2 — 2024-10-03
- All
structtypes in packagecmnow includestructs.HostLayouton Go 1.23 or later. - Added type constraints
AnyList,AnyResult, andAnyVariantin packagecmto constrain generic functions accepting any of those types. - Variant types now implement
fmt.Stringer, with aStringmethod. Breaking: variant cases namedstringmap toString_in Go. cm.Option[T]types now have aValue()convenience method that returns the zero value forTif the option represents the none case. For example, this simplifies getting an empty string or slice fromoption<string>oroption<list<T>>, respectively.- Added a release workflow to publish tagged releases to GitHub.
wit-bindgen-go --versionnow displays the version without empty().
v0.2.1 — 2024-09-26
- Generated structs and structs in package
cmnow include aHostLayoutfield in order to conform with the relaxed types proposal forGOARCH=wasm32. Thecm.HostLayouttype is an alias forstructs.HostLayouton Go 1.23 or later, and a polyfill for Go 1.22 or earlier. - #163: added
cm.F32ToU64()andcm.U64ToF32()for flatteningf32andu64types in the Canonical ABI. - Test data from bytecodealliance/wit-bindgen/tests/codegen.
- #159: correctly escape all WIT keywords, including when used in package names.
- #160: fixed the use of Go reserved keywords in function returns as result types.
- #161: correctly handle
constructoras a WIT keyword in wit. - #165: fixed use of imported types in exported functions.
- #167: fixed a logic flaw in
TestHasBorrow. - #170: resolve implied names for interface imports and exports in a world.
- #175: generated correct symbol names for imported and exported functions in worlds (
$root) or interfaces declared inline in worlds.
v0.2.0 — 2024-09-05
This project has moved! wasm-tools-go is now an official Bytecode Alliance project.
Going forward, please update your Go imports from github.com/ydnar/wasm-tools-go to github.com/bytecodealliance/wasm-tools-go. Thanks to @ricochet, @mossaka, @lxfontes, and others for their help making this possible.
- Added support for
@deprecateddirective implemented inwasm-tools#1687. - Removed support for
@sincefeature gating implemented inwasm-tools#1741.
- #151: backport support for JSON generated by
wasm-toolsprior to v1.209.0, which added@sinceand@unstablefeature gates.
v0.1.5 — 2024-08-23
wit-bindgen-go --versionnow reports the module version and git revision of thewit-bindgen-gocommand.
- Omit the default
//go:build !wasip1build tags from generated Go files. This enableswit-bindgen-goto targetGOOS=wasip1(fixes #147). - Package
witnow serializes multi-package WIT files with an un-nested “root” package. See WebAssembly/component-model#380 and bytecodealliance/wasm-tools#1700.
v0.1.4 — 2024-07-16
wit-bindgen-go generatenow accepts a--cmoption to specify the Go import path to packagecm. Used for custom or internal implementations of packagecm. Defaults togithub.com/bytecodealliance/wasm-tools-go/cm.Tuple9...Tuple16types in packagecmto align with component-model#373. Tuples with 9 to 16 types will no longer generate inlinestructtypes.- Documentation for Canonical ABI lift and lower helper functions in package
cm.
- Removed outdated documentation in design.
v0.1.3 — 2024-07-08
- #128: implemented
Stringmethod forenumtypes (@rajatjindal).
- #130: anonymous
tupletypes now correctly have exported Go struct fields. - #129: correctly handle zero-length
tupleandrecordtypes, represented asstruct{}.
v0.1.2 — 2024-07-05
- Canonical ABI lifting code for
flagsandvarianttypes. - Lifting code for
resultandvariantwill now panic if caller passes an invalid case. - Additional test coverage for
variantandflagscases.
- Package
cm: Removed unused functionsReinterpret2,LowerResult,LowerBool,BoolToU64,S64ToF64. - Package
cm: Removed unused experimentalflagsimplementation behind a build tag.
- Lifting code for
resultwith no error type will now correctly setIsErr.
v0.1.1 — 2024-07-04
This release changes the memory layout of variant and result types to permit passing these types on the stack safely. This required breaking changes to package cm, detailed below, as well as slightly more verbose type signatures for WIT functions that return a typed result.
- Type
cm.Resultis nowcm.BoolResult. - Types
cm.OKResultandcm.ErrResulthave been removed, replaced with a more generalizedcm.Result[Shape, OK, Err]type.
- WIT labels with uppercase acronyms or initialisms are now preserved in Go form. For example, the WIT name
time-EODwill result in the Go nameTimeEOD. OKis now a predefined initialism. For example, the WIT namestate-okwould previously translate into the Go nameStateOkinstead of the idiomaticStateOK.
- #95:
wit-bindgen-gonow correctly generates packeddatashape types forvariantandresulttypes. - Fixed swapped
ShapeandAligntype parameters in the functionscm.Newandcm.Casefor manipulatingvarianttypes. - Variant validation now correctly reports
variantinstead ofresultin panic messages.
v0.1.0 — 2024-07-04
Initial version, supporting TinyGo + WASI 0.2 (WASI Preview 2).
- #95:
variantandresulttypes without fully-packeddatashape types will not correctly represent all associated types. - #111:
flagstypes with > 32 labels are not correctly supported. See component-model#370 and wasm-tools#1635 for more information. - #118: Canonial ABI post-return functions to clean up allocations are not currently generated.
- Because Go does not have a native tagged union type, pointers represented in
variantandresulttypes may not be visible to the garbage collector and may be freed while still in use. - Support for mainline Go.