4 Star 0 Fork 0

Gitee 极速下载/wasmcloud

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/wasmCloud/wasmCloud
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

Golang Examples

[!WARNING] Deprecation Warning The wasmCloud Golang examples have been moved to the wasmCloud/go repo.

This folder and the examples in it will not be updated and will be removed after a new release of the wash CLI that depends on it.

This folder contains examples that can be run with wasmcloud which are written in Golang.

Most examples compile with TinyGo rather than the Golang compiler proper given that WebAssembly support landed in TinyGo first and is still slightly better supported there.

Building individual example components

Example components built in Golang can be compiled similarly to any other wasmcloud project:

wash build

WebAssembly support

As WebAssembly is intended to be a "compilation target" for native Golang code, upstream work is underway to integrate and improve support for the various standards of WebAssembly.

Language Core Modules (wasm32-unknown-unknown) Preview 1 (wasm32-wasi-preview1) WASIP2 (wasm32-wasip2)
Golang ✅ (GOOS=js,GOARCH=wasm) ✅ (GOOS=wasip1) ✅ (requires adapter)
TinyGo ✅ (-target=wasm) ✅ (-target=wasi) ✅ (requires adapter)

Tiny Go WASI support is detailed on their website. Golang WASI preview 1 support was announced on the Golang blog

[!NOTE] Don't know what wasm32-unknown-unknown means versus wasm32-wasi-preview1?

wasm32-unknown-unknown is a compile target which deals in core WebAssembly modules (i.e. you're only given access to numbers at this level) wasm32-wasi-preview1 is a compile target that provides richer types, support for more higher level platform APIs wasm32-wasip2 is the next generation compile target with much richer types, higher level APIs like async, streaming, the WIT IDL.

In a sentence, WebAssembly functionality is layered, with wasm32-unknown-unknown being the most basic (only doing operations on numbers) and wasm32-wasip2 being the current most advanced.

Want to learn more?

To learn more about how wasmCloud works, check out the wasmCloud documentation.

To learn more WebAssembly ecosystem language support, check out the SIG Guest Languages Zulip group and the issue noting go support.

Development on Golang support (along with Tinygo support) is stewarded by the Bytecode Alliance.

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Rust
1
https://gitee.com/mirrors/wasmcloud.git
git@gitee.com:mirrors/wasmcloud.git
mirrors
wasmcloud
wasmcloud
main

搜索帮助