GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - bytecodealliance/go-modules: WebAssembly, WASI, and Component Model tools for Go

BranchesTags
Open more actions menu

Latest commit

 

History

1,835 Commits
1,835 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
.vscode
.vscode
 
 
cm
cm
 
 
cmd/wit-bindgen-go
cmd/wit-bindgen-go
 
 
internal
internal
 
 
scripts
scripts
 
 
testdata
testdata
 
 
tests
tests
 
 
wit
wit
 
 
x
x
 
 
.gitignore
.gitignore
 
 
.prettierignore
.prettierignore
 
 
.prettierrc.json
.prettierrc.json
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
DESIGN.md
DESIGN.md
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
ORG_CODE_OF_CONDUCT.md
ORG_CODE_OF_CONDUCT.md
 
 
README.md
README.md
 
 
RELEASE.md
RELEASE.md
 
 
go.mod
go.mod
 
 
go.sum
go.sum
 
 
go.work
go.work
 
 

Repository files navigation

go.bytecodealliance.org

pkg.go.dev build status

WebAssembly, WASI, and Component Model tools for Go and TinyGo.

About

Package wit/bindgen contains code to generate Go bindings for Component Model interfaces defined in WIT (WebAssembly Interface Type) files. A goal of this project is to accelerate adoption of the Component Model and development of WASI 0.2+ in Go.

Component Model

Package cm contains helper types and functions used by generated packages, such as option<t>, result<ok, err>, variant, list, and resource. These are intended for use by generated Component Model bindings, where the caller converts to a Go equivalent. It attempts to map WIT semantics to their equivalent in Go where possible.

wit-bindgen-go

WIT → Go

wit-bindgen-go generates Go bindings for WIT interfaces and worlds. It generates a Go package for each WIT world and interface, with the necessary types, functions, methods, and ABI glue code. Generated code will depend on package cm for core Component Model types like list<t>.

wit-bindgen-go generate ../wasi-cli/wit

It also supports the JSON representation of a fully-resolved WIT package:

wit-bindgen-go generate wasi-cli.wit.json

Or pipe via stdin:

wasm-tools component wit -j --all-features ../wasi-cli/wit | wit-bindgen-go generate

JSON → WIT

For debugging purposes, wit-bindgen-go can also convert a JSON representation back into WIT. This is useful for validating that the intermediate representation faithfully represents the original WIT source.

wit-bindgen-go wit example.wit.json

WIT → JSON

Package wit can decode a JSON representation of a fully-resolved WIT file. Serializing WIT into JSON requires wasm-tools v1.210.0 or higher. To convert a WIT file into JSON, run wasm-tools with the -j argument:

wasm-tools component wit -j --all-features example.wit

This will emit JSON on stdout, which can be piped to a file or another program.

wasm-tools component wit -j --all-features example.wit > example.wit.json

Memory Safety and Garbage Collection

Package cm and generated bindings from wit-bindgen-go may have compatibility issues with the Go garbage collector. This is due to the memory representation of variant and result types as tagged unions where a pointer shape may be occupied by a non-pointer value. In Go (but not TinyGo), the GC may detect and throw an error if it detects a non-pointer value in an area it expects to see a pointer. This is an area of active development.

License

This project is licensed under the Apache 2.0 license with the LLVM exception. See LICENSE for more details.

About

WebAssembly, WASI, and Component Model tools for Go

go.bytecodealliance.org

Topics

component-modelgogolangwasiwasmwebassembly

Resources

Readme
Apache-2.0 license

Code of conduct

Code of conduct

Contributing

Contributing
Activity
Custom properties

Stars

148 stars

Watchers

8 watching

Forks

21 forks
Report repository

Releases

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.