Skip to content

Commit

Permalink
Update TinyGo docs to reflect statics fix
Browse files Browse the repository at this point in the history
Signed-off-by: itowlson <[email protected]>
  • Loading branch information
itowlson committed Jan 12, 2025
1 parent be74787 commit e4258fb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion content/spin/v3/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ The build command calls TinyGo with the WASI backend and appropriate options:

```toml
[component.hello.build]
command = "tinygo build -target=wasi -gc=leaking -no-debug -o main.wasm main.go"
command = "tinygo build -target=wasip1 -gc=leaking -scheduler=none -buildmode=c-shared -no-debug -o main.wasm ."
```

{{ blockEnd }}
Expand Down
8 changes: 4 additions & 4 deletions content/spin/v3/go-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Using TinyGo to compile components for Spin is currently required, as the

## Versions

TinyGo `0.30.0` is recommended, which requires Go `v1.19+`.
TinyGo `0.35.0` is recommended, which requires Go `v1.20+`. Older versions of TinyGo may not support the command-line flags used when building Spin applications.

## HTTP Components

Expand Down Expand Up @@ -70,7 +70,7 @@ The Spin HTTP component (written in Go) can be built using the `tingygo` toolcha
<!-- @selectiveCpy -->

```bash
$ tinygo build -o main.wasm -target=wasi main.go
$ tinygo build -target=wasip1 -gc=leaking -scheduler=none -buildmode=c-shared -no-debug -o main.wasm .
```

Once built, we can run our Spin HTTP component using the Spin up command:
Expand Down Expand Up @@ -150,7 +150,7 @@ The Outbound HTTP Request example above can be built using the `tingygo` toolcha
<!-- @selectiveCpy -->

```bash
$ tinygo build -o main.wasm -target=wasi main.go
$ tinygo build -target=wasip1 -gc=leaking -scheduler=none -buildmode=c-shared -no-debug -o main.wasm .
```

Before we can execute this component, we need to add the
Expand Down Expand Up @@ -255,7 +255,7 @@ component = "echo-message"
[component.echo-message]
source = "main.wasm"
[component.echo-message.build]
command = "tinygo build -target=wasi -gc=leaking -no-debug -o main.wasm main.go"
command = "tinygo build -target=wasip1 -gc=leaking -scheduler=none -buildmode=c-shared -no-debug -o main.wasm ."
```

The application will connect to `redis://localhost:6379`, and for every new message
Expand Down
8 changes: 4 additions & 4 deletions content/spin/v3/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ component = "hello-go"
source = "main.wasm"
allowed_outbound_hosts = []
[component.hello-go.build]
command = "tinygo build -target=wasi -gc=leaking -no-debug -o main.wasm main.go"
command = "tinygo build -target=wasip1 -gc=leaking -scheduler=none -buildmode=c-shared -no-debug -o main.wasm ."
```

This represents a simple Spin HTTP application (triggered by an HTTP request). It has:
Expand Down Expand Up @@ -822,7 +822,7 @@ You can always run this command manually; `spin build` is a shortcut.

```bash
$ spin build
Executing the build command for component hello-go: tinygo build -target=wasi -gc=leaking -no-debug -o main.wasm main.go
Executing the build command for component hello-go: tinygo build -target=wasip1 -gc=leaking -scheduler=none -buildmode=c-shared -no-debug -o main.wasm .
go: downloading github.com/fermyon/spin/sdk/go v0.10.0
Finished building all Spin components
```
Expand All @@ -831,14 +831,14 @@ If the build fails, check:

* Are you in the `hello_go` directory?
* Did you successfully [install TinyGo](#install-the-tools)?
* Are your versions of Go and TinyGo up to date? The Spin SDK needs TinyGo 0.27 or above.
* Are your versions of Go and TinyGo up to date? The Spin SDK needs TinyGo 0.35 or above and Go 1.20 or above.
* Set Environment Variable `CGO_ENABLED=1`. (Since the Go SDK is built using CGO, it requires the CGO_ENABLED=1 environment variable to be set.)

If you would like to know what build command Spin runs for a component, you can find it in the manifest, in the `component.(id).build` section:

```toml
[component.hello-go.build]
command = "tinygo build -target=wasi -gc=leaking -no-debug -o main.wasm main.go"
command = "tinygo build -target=wasip1 -gc=leaking -scheduler=none -buildmode=c-shared -no-debug -o main.wasm ."
```

You can always run this command manually; `spin build` is a shortcut to save you having to remember it.
Expand Down

0 comments on commit e4258fb

Please sign in to comment.