Skip to content

Commit 42f5e55

Browse files
committed
docs: small corrections for README regarding wasm
Signed-off-by: deadprogram <[email protected]>
1 parent 81da7bb commit 42f5e55

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,22 @@ Here is a small TinyGo program for use by a WASI host application:
4848
```go
4949
package main
5050

51-
//go:wasm-module yourmodulename
52-
//export add
51+
//go:wasmexport add
5352
func add(x, y uint32) uint32 {
5453
return x + y
5554
}
55+
```
56+
57+
This compiles the above TinyGo program for use on any WASI Preview 1 runtime:
5658

57-
// main is required for the `wasip1` target, even if it isn't used.
58-
func main() {}
59+
```shell
60+
tinygo build -buildmode=c-shared -o add.wasm -target=wasip1 add.go
5961
```
6062

61-
This compiles the above TinyGo program for use on any WASI runtime:
63+
You can also use the same syntax as Go 1.24+:
6264

6365
```shell
64-
tinygo build -o main.wasm -target=wasip1 main.go
66+
GOARCH=wasip1 GOOS=wasm tinygo build -buildmode=c-shared -o add.wasm add.go
6567
```
6668

6769
## Installation

0 commit comments

Comments
 (0)