Skip to content

Commit 8f80acb

Browse files
committed
fix(templates/http-go): Remove scheduler flag from http-go build command
This removes the `-scheduler=none` flag from the build command in the http-go template. Including this flag prevents Spin applications using `http.Transport` from compiling. ``` ❯ spin build Building component http-roundtrip-test with `tinygo build -target=wasip1 -gc=leaking -scheduler=none -buildmode=c-shared -no-debug -o main.wasm .` /opt/homebrew/Cellar/tinygo/0.35.0/src/net/http/transfer.go:213:2: attempted to start a goroutine without a scheduler Error: Build command for component http-roundtrip-test failed with status Exited(1) ``` Signed-off-by: Adam Reese <[email protected]>
1 parent 771282e commit 8f80acb

File tree

6 files changed

+11
-12
lines changed

6 files changed

+11
-12
lines changed

crates/componentize/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,8 +440,9 @@ mod tests {
440440
let mut cmd = process::Command::new("tinygo");
441441
cmd.arg("build")
442442
.current_dir("tests/go-case")
443-
.arg("-target=wasi")
443+
.arg("-target=wasip1")
444444
.arg("-gc=leaking")
445+
.arg("-buildmode=c-shared")
445446
.arg("-no-debug")
446447
.arg("-o")
447448
.arg(out_dir.join("go_case.wasm"))

crates/componentize/tests/go-case/main.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
package main
22

33
import (
4-
"fmt"
5-
"net/http"
64
"errors"
7-
"strings"
5+
"fmt"
86
"io"
7+
"net/http"
98
"os"
9+
"strings"
1010

11-
spinredis "github.com/fermyon/spin/sdk/go/redis"
12-
spinhttp "github.com/fermyon/spin/sdk/go/http"
1311
spinconfig "github.com/fermyon/spin/sdk/go/config"
12+
spinhttp "github.com/fermyon/spin/sdk/go/http"
13+
spinredis "github.com/fermyon/spin/sdk/go/redis"
1414
)
1515

1616
func init() {
@@ -65,5 +65,3 @@ func execute(v []string) error {
6565

6666
return nil
6767
}
68-
69-
func main() {}

crates/componentize/tests/go-case/spin.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ allowed_http_hosts = []
1212
[component.trigger]
1313
route = "/..."
1414
[component.build]
15-
command = "tinygo build -target=wasi -gc=leaking -no-debug -o main.wasm main.go"
15+
command = "tinygo build -target=wasip1 -gc=leaking -buildmode=c-shared -no-debug -o main.wasm ."

templates/http-go/content/spin.toml

Lines changed: 1 addition & 1 deletion
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=wasip1 -gc=leaking -scheduler=none -buildmode=c-shared -no-debug -o main.wasm ."
17+
command = "tinygo build -target=wasip1 -gc=leaking -buildmode=c-shared -no-debug -o main.wasm ."
1818
watch = ["**/*.go", "go.mod"]

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

Lines changed: 1 addition & 1 deletion
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=wasip1 -gc=leaking -scheduler=none -buildmode=c-shared -no-debug -o main.wasm ."
9+
command = "tinygo build -target=wasip1 -gc=leaking -buildmode=c-shared -no-debug -o main.wasm ."
1010
workdir = "{{ output-path }}"
1111
watch = ["**/*.go", "go.mod"]

templates/redis-go/content/spin.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ component = "{{project-name | kebab_case}}"
1717
source = "main.wasm"
1818
allowed_outbound_hosts = []
1919
[component.{{project-name | kebab_case}}.build]
20-
command = "tinygo build -target=wasi -gc=leaking -no-debug -o main.wasm main.go"
20+
command = "tinygo build -target=wasip1 -gc=leaking -buildmode=c-shared -no-debug -o main.wasm ."

0 commit comments

Comments
 (0)