Skip to content

Commit

Permalink
fix: update examples for tinygo 0.34
Browse files Browse the repository at this point in the history
  • Loading branch information
zshipko committed Nov 1, 2024
1 parent f2b28ca commit c0e2660
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Install TinyGo
uses: acifani/setup-tinygo@v1.1.0
with:
tinygo-version: 0.33.0
tinygo-version: 0.34.0
binaryen-version: "116"

- name: Compile example
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.PHONY: example
example:
tinygo build -o example/tiny_countvowels.wasm -target wasi ./example/countvowels
tinygo build -o example/tiny_http.wasm -target wasi ./example/http
tinygo build -o example/tiny_reactor.wasm -target wasi ./example/reactor
tinygo build -o example/tiny_countvowels.wasm -target wasi -buildmode c-shared ./example/countvowels
tinygo build -o example/tiny_http.wasm -target wasi -buildmode c-shared ./example/http
tinygo build -o example/tiny_reactor.wasm -target wasi -buildmode c-shared ./example/reactor

GOOS=wasip1 GOARCH=wasm go build -tags std -o example/std_countvowels.wasm ./example/countvowels
GOOS=wasip1 GOARCH=wasm go build -tags std -o example/std_http.wasm ./example/http
Expand All @@ -14,5 +14,5 @@ test:
extism call example/tiny_countvowels.wasm count_vowels_roundtrip_json_mem --wasi

extism call example/std_countvowels.wasm _start --wasi --input "this is a test" --set-config '{"thing": "1234"}'
extism call example/std_http.wasm _start --wasi --log-level info --allow-host "jsonplaceholder.typicode.com"
extism call example/std_http.wasm http_get --wasi --log-level info --allow-host "jsonplaceholder.typicode.com"

4 changes: 1 addition & 3 deletions example/countvowels/tiny_main.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func countVowelsJSONRoundtripMem() int32 {
return 0
}

//export count_vowels
//go:wasmexport count_vowels
func countVowels() int32 {
input := pdk.Input()

Expand Down Expand Up @@ -102,5 +102,3 @@ func countVowels() int32 {

return 0
}

func main() {}
1 change: 0 additions & 1 deletion example/http/tiny_main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,3 @@ func httpGet() int32 {
return 0
}

func main() {}
5 changes: 1 addition & 4 deletions example/reactor/tiny_main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ import (
"os"

"github.com/extism/go-pdk"
_ "github.com/extism/go-pdk/wasi-reactor"
)

//export read_file
//go:wasmexport read_file
func readFile() {
name := pdk.InputString()

Expand All @@ -22,5 +21,3 @@ func readFile() {

pdk.Output(content)
}

func main() {}

0 comments on commit c0e2660

Please sign in to comment.