{"id":13489657,"url":"https://github.com/bytecodealliance/wasmtime-go","last_synced_at":"2025-04-23T20:59:55.444Z","repository":{"id":37498093,"uuid":"250593397","full_name":"bytecodealliance/wasmtime-go","owner":"bytecodealliance","description":"Go WebAssembly runtime powered by Wasmtime","archived":false,"fork":false,"pushed_at":"2025-04-21T16:54:51.000Z","size":3467875,"stargazers_count":821,"open_issues_count":31,"forks_count":82,"subscribers_count":16,"default_branch":"main","last_synced_at":"2025-04-23T20:59:46.624Z","etag":null,"topics":["go","golang","runtime","rust","wasi","wasm","wasmtime","webassembly"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/bytecodealliance/wasmtime-go","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":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-03-27T17:02:00.000Z","updated_at":"2025-04-21T16:53:42.000Z","dependencies_parsed_at":"2023-09-29T16:47:48.691Z","dependency_job_id":"5ef10efa-d887-4788-8ef3-86b4e8cb89dc","html_url":"https://github.com/bytecodealliance/wasmtime-go","commit_stats":{"total_commits":231,"total_committers":23,"mean_commits":"10.043478260869565","dds":"0.21212121212121215","last_synced_commit":"66086d3cc5430a0026da19f98542946acd908006"},"previous_names":[],"tags_count":66,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytecodealliance%2Fwasmtime-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytecodealliance%2Fwasmtime-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytecodealliance%2Fwasmtime-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytecodealliance%2Fwasmtime-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bytecodealliance","download_url":"https://codeload.github.com/bytecodealliance/wasmtime-go/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250514767,"owners_count":21443208,"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":["go","golang","runtime","rust","wasi","wasm","wasmtime","webassembly"],"created_at":"2024-07-31T19:00:32.664Z","updated_at":"2025-04-23T20:59:55.438Z","avatar_url":"https://github.com/bytecodealliance.png","language":"Go","readme":"\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003e\u003ccode\u003ewasmtime-go\u003c/code\u003e\u003c/h1\u003e\n\n  \u003cp\u003e\n    \u003cstrong\u003eGo embedding of\n    \u003ca href=\"https://github.com/bytecodealliance/wasmtime\"\u003eWasmtime\u003c/a\u003e\u003c/strong\u003e\n  \u003c/p\u003e\n\n  \u003cstrong\u003eA \u003ca href=\"https://bytecodealliance.org/\"\u003eBytecode Alliance\u003c/a\u003e project\u003c/strong\u003e\n\n  \u003cp\u003e\n    \u003ca href=\"https://github.com/bytecodealliance/wasmtime-go/actions?query=workflow%3ACI\"\u003e\n      \u003cimg src=\"https://github.com/bytecodealliance/wasmtime-go/workflows/CI/badge.svg\" alt=\"CI status\"/\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://pkg.go.dev/github.com/bytecodealliance/wasmtime-go/v32\"\u003e\n      \u003cimg src=\"https://godoc.org/github.com/bytecodealliance/wasmtime-go/v32?status.svg\" alt=\"Documentation\"/\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://bytecodealliance.github.io/wasmtime-go/coverage.html\"\u003e\n      \u003cimg src=\"https://img.shields.io/badge/coverage-main-green\" alt=\"Code Coverage\"/\u003e\n    \u003c/a\u003e\n  \u003c/p\u003e\n\n\u003c/div\u003e\n\n## Installation\n\n```sh\ngo get -u github.com/bytecodealliance/wasmtime-go/v32@v32.0.0\n```\n\nBe sure to check out the [API documentation][api]!\n\nThis Go library uses CGO to consume the C API of the [Wasmtime\nproject][wasmtime] which is written in Rust. Precompiled binaries of Wasmtime\nare checked into this repository on tagged releases so you won't have to install\nWasmtime locally, but it means that this project only works on Linux x86\\_64,\nmacOS x86\\_64 , and Windows x86\\_64 currently. Building on other platforms will\nneed to arrange to build Wasmtime and use `CGO_*` env vars to compile correctly.\n\nThis project has been tested with Go 1.13 or later.\n\n[api]: https://pkg.go.dev/github.com/bytecodealliance/wasmtime-go/v32\n[wasmtime]: https://github.com/bytecodealliance/wasmtime\n\nIf you are a bazel user, add following to your WORKSPACE file:\n\n```\ngo_repository(\n    name = \"com_github_bytecodealliance_wasmtime_go\",\n    importpath = \"github.com/bytecodealliance/wasmtime-go/v32\",\n    version = \"v32.0.0\",\n)\n```\n\n## Usage\n\nA \"Hello, world!\" example of using this package looks like:\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"github.com/bytecodealliance/wasmtime-go/v32\"\n)\n\nfunc main() {\n    // Almost all operations in wasmtime require a contextual `store`\n    // argument to share, so create that first\n    store := wasmtime.NewStore(wasmtime.NewEngine())\n\n    // Compiling modules requires WebAssembly binary input, but the wasmtime\n    // package also supports converting the WebAssembly text format to the\n    // binary format.\n    wasm, err := wasmtime.Wat2Wasm(`\n      (module\n        (import \"\" \"hello\" (func $hello))\n        (func (export \"run\")\n          (call $hello))\n      )\n    `)\n    check(err)\n\n    // Once we have our binary `wasm` we can compile that into a `*Module`\n    // which represents compiled JIT code.\n    module, err := wasmtime.NewModule(store.Engine, wasm)\n    check(err)\n\n    // Our `hello.wat` file imports one item, so we create that function\n    // here.\n    item := wasmtime.WrapFunc(store, func() {\n        fmt.Println(\"Hello from Go!\")\n    })\n\n    // Next up we instantiate a module which is where we link in all our\n    // imports. We've got one import so we pass that in here.\n    instance, err := wasmtime.NewInstance(store, module, []wasmtime.AsExtern{item})\n    check(err)\n\n    // After we've instantiated we can lookup our `run` function and call\n    // it.\n    run := instance.GetFunc(store, \"run\")\n    if run == nil {\n        panic(\"not a function\")\n    }\n    _, err = run.Call(store)\n    check(err)\n}\n\nfunc check(e error) {\n    if e != nil {\n        panic(e)\n    }\n}\n```\n\n## Contributing\n\nSo far this extension has been written by folks who are primarily Rust\nprogrammers, so it's highly likely that there's some faux pas in terms of Go\nidioms. Feel free to send a PR to help make things more idiomatic if you see\nsomething!\n\nTo work on this extension locally you'll first want to clone the project:\n\n```sh\n$ git clone https://github.com/bytecodealliance/wasmtime-go\n```\n\nNext up you'll want to have a [local Wasmtime build\navailable](https://bytecodealliance.github.io/wasmtime/contributing-building.html).\n\nYou'll need to build at least the `wasmtime-c-api` crate, which, at the time of\nthis writing, would be:\n\n```sh\n$ cargo build -p wasmtime-c-api\n```\n\nOnce you've got that you can set up the environment of this library with:\n\n```sh\n$ ./ci/local.sh /path/to/wasmtime\n```\n\nThis will create a `build` directory which has the compiled libraries and header\nfiles. Next up you can run normal commands such as:\n\n```sh\n$ go test\n```\n\nAnd after that you should be good to go!\n\n### Release Checklist\n\nFirst run:\n\n```\n$ python3 ci/download-wasmtime.py\n$ go test\n```\n\nMake sure everything passes at the current version.\n\nNext run:\n\n```\n$ git ls-files | xargs sed -i 's/v16/v17/g'\n$ python3 ci/download-wasmtime.py\n$ go test\n```\n\nFix all errors and such and then commit and make a PR.\n\nOnce merged checkout `main` and do:\n\n```\n$ rm .gitignore\n$ python3 ci/download-wasmtime.py\n$ git add .\n$ git commit -m 'v32.0.0 release artifacts'\n$ git tag v32.0.0\n```\n\nand push up the tag\n","funding_links":[],"categories":["Go","Go Runtimes","webassembly"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytecodealliance%2Fwasmtime-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbytecodealliance%2Fwasmtime-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytecodealliance%2Fwasmtime-go/lists"}