{"id":25694623,"url":"https://github.com/bytecodealliance/go-modules","last_synced_at":"2025-07-12T01:13:17.577Z","repository":{"id":190699583,"uuid":"683183284","full_name":"bytecodealliance/go-modules","owner":"bytecodealliance","description":"WebAssembly, WASI, and Component Model tools for Go","archived":false,"fork":false,"pushed_at":"2025-07-04T17:45:46.000Z","size":12978,"stargazers_count":120,"open_issues_count":27,"forks_count":16,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-07-12T00:44:55.548Z","etag":null,"topics":["component-model","go","golang","wasi","wasm","webassembly"],"latest_commit_sha":null,"homepage":"https://go.bytecodealliance.org","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bytecodealliance.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-08-25T19:48:16.000Z","updated_at":"2025-07-08T18:22:33.000Z","dependencies_parsed_at":"2024-01-22T20:44:45.893Z","dependency_job_id":"1ec8d72b-c7b3-4629-abc9-50170079f955","html_url":"https://github.com/bytecodealliance/go-modules","commit_stats":null,"previous_names":["ydnar/wit-bindgen-go","bytecodealliance/wasm-tools-go","bytecodealliance/go-modules"],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/bytecodealliance/go-modules","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytecodealliance%2Fgo-modules","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytecodealliance%2Fgo-modules/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytecodealliance%2Fgo-modules/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytecodealliance%2Fgo-modules/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bytecodealliance","download_url":"https://codeload.github.com/bytecodealliance/go-modules/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytecodealliance%2Fgo-modules/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264922908,"owners_count":23683705,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["component-model","go","golang","wasi","wasm","webassembly"],"created_at":"2025-02-25T00:01:16.212Z","updated_at":"2025-07-12T01:13:17.569Z","avatar_url":"https://github.com/bytecodealliance.png","language":"Go","readme":"# go.bytecodealliance.org\n\n[![pkg.go.dev](https://img.shields.io/badge/docs-pkg.go.dev-blue.svg)](https://pkg.go.dev/go.bytecodealliance.org) [![build status](https://img.shields.io/github/actions/workflow/status/bytecodealliance/go-modules/test.yaml?branch=main)](https://github.com/bytecodealliance/go-modules/actions)\n\n[WebAssembly](https://webassembly.org), [WASI](https://wasi.dev), and [Component Model](https://component-model.bytecodealliance.org/) tools for [Go](https://go.dev) and [TinyGo](https://tinygo.org).\n\n## About\n\nPackage `wit/bindgen` contains code to generate Go bindings for [Component Model](https://component-model.bytecodealliance.org/) interfaces defined in [WIT](https://component-model.bytecodealliance.org/design/wit.html) (WebAssembly Interface Type) files. A goal of this project is to accelerate adoption of the Component Model and development of [WASI 0.2+](https://bytecodealliance.org/articles/WASI-0.2) in Go.\n\n### Component Model\n\nPackage `cm` contains helper types and functions used by generated packages, such as `option\u003ct\u003e`, `result\u003cok, err\u003e`, `variant`, `list`, and `resource`. These are intended for use by generated [Component Model](https://github.com/WebAssembly/component-model/blob/main/design/mvp/Explainer.md#type-definitions) bindings, where the caller converts to a Go equivalent. It attempts to map WIT semantics to their equivalent in Go where possible.\n\n## `wit-bindgen-go`\n\n### WIT → Go\n\n`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\u003ct\u003e`.\n\n```console\nwit-bindgen-go generate ../wasi-cli/wit\n```\n\nIt also supports the [JSON representation](https://github.com/bytecodealliance/wasm-tools/pull/1203) of a fully-resolved WIT package:\n\n```console\nwit-bindgen-go generate wasi-cli.wit.json\n```\n\nOr pipe via `stdin`:\n\n```console\nwasm-tools component wit -j --all-features ../wasi-cli/wit | wit-bindgen-go generate\n```\n\n### JSON → WIT\n\nFor 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.\n\n```console\nwit-bindgen-go wit example.wit.json\n```\n\n### WIT → JSON\n\nPackage `wit` can decode a JSON representation of a fully-resolved WIT file. Serializing WIT into JSON requires [wasm-tools](https://crates.io/crates/wasm-tools) v1.210.0 or higher. To convert a WIT file into JSON, run `wasm-tools` with the `-j` argument:\n\n```console\nwasm-tools component wit -j --all-features example.wit\n```\n\nThis will emit JSON on `stdout`, which can be piped to a file or another program.\n\n```console\nwasm-tools component wit -j --all-features example.wit \u003e example.wit.json\n```\n\n## Memory Safety and Garbage Collection\n\nPackage `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.\n\n## License\n\nThis project is licensed under the Apache 2.0 license with the LLVM exception. See [LICENSE](LICENSE) for more details.\n","funding_links":[],"categories":["WebAssembly","Tools"],"sub_categories":["WASI and WASM Unknown","Programming Language Support"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytecodealliance%2Fgo-modules","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbytecodealliance%2Fgo-modules","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytecodealliance%2Fgo-modules/lists"}