Adding this code snippet into the main.go just after a w4 init
var s = []int{1}
//go:export start
func start() {
s = append(s, 2)
}
compiles fine but fails at runtime with the blue screen error
The cartridge has tried to import a missing function. See console for more details.
Unfortunately there is nothing in the console.
We recently merged this target.json for games written in Go, maybe we're missing something there, I don't know:
{
"llvm-target": "wasm32-unknown-unknown",
"cpu": "generic",
"features": "+mutable-globals,+nontrapping-fptoint,+sign-ext,+bulk-memory",
"build-tags": [
"tinygo.wasm",
"wasm_unknown"
],
"goos": "linux",
"goarch": "arm",
"linker": "wasm-ld",
"rtlib": "compiler-rt",
"scheduler": "none",
"cflags": [
"-mno-bulk-memory",
"-mnontrapping-fptoint",
"-msign-ext"
],
"ldflags": [
"--allow-undefined",
"--no-demangle",
"--import-memory",
"--initial-memory=65536",
"--max-memory=65536",
"--stack-first",
"--no-entry",
"-zstack-size=14752"
]
}
So for now, append() can't be used at all, which is very annoying :(
Using
$ tinygo version
tinygo version 0.34.0 linux/amd64 (using go version go1.23.3 and LLVM version 18.1.2)
Adding this code snippet into the
main.gojust after aw4 initcompiles fine but fails at runtime with the blue screen error
Unfortunately there is nothing in the console.
We recently merged this
target.jsonfor games written in Go, maybe we're missing something there, I don't know:{ "llvm-target": "wasm32-unknown-unknown", "cpu": "generic", "features": "+mutable-globals,+nontrapping-fptoint,+sign-ext,+bulk-memory", "build-tags": [ "tinygo.wasm", "wasm_unknown" ], "goos": "linux", "goarch": "arm", "linker": "wasm-ld", "rtlib": "compiler-rt", "scheduler": "none", "cflags": [ "-mno-bulk-memory", "-mnontrapping-fptoint", "-msign-ext" ], "ldflags": [ "--allow-undefined", "--no-demangle", "--import-memory", "--initial-memory=65536", "--max-memory=65536", "--stack-first", "--no-entry", "-zstack-size=14752" ] }So for now,
append()can't be used at all, which is very annoying :(Using