Open mattjohnsonpint opened 2 months ago
I think this will probably be solved by https://github.com/tinygo-org/tinygo/pull/4437
/cc @aykevl
The problem here is the file extension, which apparently overrides the environment variables. That's a bug.
Maybe we should just remove this special case? It means that people that currently rely on the extension will have to provide some explicit flags or environment variables, but it's certainly more explicit and less "magic". (I think it was originally introduced when wasm was mostly a browser thing and WASI didn't really exist yet).
My understanding is that setting
GOOS=wasip1 GOARCH=wasm
should produce identical output as passing the-target wasi
command line flag, but it doesn't. Rather, it seem to match-target wasm
.Repro:
You'll need
wasm2wat
from The WebAssembly Binary Toolkit.Then:
Compile the different ways. Optimizations off to see everything.
Convert output to WAT format for readability
Open each wat file in a text editor. Imports are near the top, exports are near the bottom.
test1.wat
test2.wat / test3.wat
They should be identical, but test3 is importing from
gojs
, and is also exportinggo_scheduler
. It's identical to test2, whereas I would expect it to match test1.