Skip to content

Commit 771282e

Browse files
authored
Merge pull request #2977 from itowlson/tinygo-global-init-fixes
Update TinyGo templates to address static init problems
2 parents 511bf55 + ee541b8 commit 771282e

File tree

9 files changed

+10
-15
lines changed

9 files changed

+10
-15
lines changed

.devcontainer/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ FROM mcr.microsoft.com/vscode/devcontainers/rust:0-${VARIANT}
99
# && apt-get -y install --no-install-recommends <your-package-list-here>
1010

1111
# Go installation, see https://go.dev/doc/install
12-
ARG GO_URL="https://go.dev/dl/go1.20.1.linux-amd64.tar.gz"
12+
ARG GO_URL="https://go.dev/dl/go1.22.0.linux-amd64.tar.gz"
1313
RUN curl -sL "$GO_URL" | tar -xzf - -C /usr/local
1414
ENV PATH "$PATH:/usr/local/go/bin"
1515

1616
# TinyGo installation, see https://tinygo.org/getting-started/install/linux/ for instructions
17-
ARG TINYGO_URL="https://github.com/tinygo-org/tinygo/releases/download/v0.27.0/tinygo_0.27.0_amd64.deb"
17+
ARG TINYGO_URL="https://github.com/tinygo-org/tinygo/releases/download/v0.35.0/tinygo_0.35.0_amd64.deb"
1818
RUN curl -sL "$TINYGO_URL" -o tinygo_amd64.deb && dpkg -i tinygo_amd64.deb && rm tinygo_amd64.deb
1919

2020
# Install the gopls Go Language Server, see https://github.com/golang/tools/tree/master/gopls

.github/actions/spin-ci-dependencies/action.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ inputs:
4646
type: bool
4747
golang-version:
4848
description: 'golang version to setup'
49-
default: '1.20'
49+
default: '1.22'
5050
required: false
5151
type: string
5252

@@ -68,7 +68,7 @@ inputs:
6868
type: bool
6969
tinygo-version:
7070
description: 'tinygo version to setup'
71-
default: 'v0.27.0'
71+
default: 'v0.35.0'
7272
required: false
7373
type: string
7474

.github/workflows/build.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,10 @@ jobs:
200200
- uses: goto-bus-stop/setup-zig@v2
201201
- uses: actions/setup-go@v4
202202
with:
203-
go-version: '1.20.1'
203+
go-version: '1.22'
204204
- uses: acifani/setup-tinygo@v2
205205
with:
206-
tinygo-version: '0.27.0'
206+
tinygo-version: '0.35.0'
207207
- uses: actions/setup-node@v3
208208
with:
209209
node-version: '20.x'

templates/http-go/content/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/{{project-name | snake_case}}
22

3-
go 1.20
3+
go 1.22
44

55
require github.com/fermyon/spin/sdk/go/v2 v2.2.0
66

templates/http-go/content/main.go

-2
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,3 @@ func init() {
1313
fmt.Fprintln(w, "Hello Fermyon!")
1414
})
1515
}
16-
17-
func main() {}

templates/http-go/content/spin.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ component = "{{project-name | kebab_case}}"
1414
source = "main.wasm"
1515
allowed_outbound_hosts = []
1616
[component.{{project-name | kebab_case}}.build]
17-
command = "tinygo build -target=wasi -gc=leaking -no-debug -o main.wasm main.go"
17+
command = "tinygo build -target=wasip1 -gc=leaking -scheduler=none -buildmode=c-shared -no-debug -o main.wasm ."
1818
watch = ["**/*.go", "go.mod"]

templates/http-go/metadata/snippets/component.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ component = "{{project-name | kebab_case}}"
66
source = "{{ output-path }}/main.wasm"
77
allowed_outbound_hosts = []
88
[component.{{project-name | kebab_case}}.build]
9-
command = "tinygo build -target=wasi -gc=leaking -no-debug -o main.wasm main.go"
9+
command = "tinygo build -target=wasip1 -gc=leaking -scheduler=none -buildmode=c-shared -no-debug -o main.wasm ."
1010
workdir = "{{ output-path }}"
1111
watch = ["**/*.go", "go.mod"]

templates/redis-go/content/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module github.com/{{project-name | snake_case}}
22

3-
go 1.20
3+
go 1.22
44

55
require github.com/fermyon/spin/sdk/go/v2 v2.2.0

templates/redis-go/content/main.go

-3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,3 @@ func init() {
1414
return nil
1515
})
1616
}
17-
18-
// main functiion must be included for the compiler but is not executed.
19-
func main() {}

0 commit comments

Comments
 (0)