go test run configuration for web assembly

When running the `go test` run configuration on a web assembly project, the commands ran by goland can't actually run code compiled for web assembly. Without goland, if you want to have gotest run the wasm files properly, you need to add the -exec file pointed to the right exec environment. But goland compiles the test results and then run those with test2json, which wasn't compiled for wasm.

It works for directories as the command goland runs is `$GOROOT/go test -json -exec go_js_wasm_exec ./...` but you can't debug directories and test can be very slow to run.

When trying to run on a file or a module, goland will instead use these commands: 

$GOROOT/go test -c -exec go_js_wasm_exec -o <random temp file> <file or module> #gosetup
$GOROOT/go tool test2json -t <same temp file> -test.v #gosetup

Since test2json is not a tool compiled in web assembly, it will always fail with `exec format error`.

Would there be a way to have goland use the go test command with -json rather than test2json for specific files? Maybe using the -run flag?

Please sign in to leave a comment.