Closed
Description
What version of Go are you using (go version
)?
$ go version go version go1.21.0 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GO111MODULE='' GOARCH='wasm' GOBIN='' GOCACHE='/home/h/.cache/go-build' GOENV='/home/h/.config/go/env' GOEXE='' GOEXPERIMENT='' GOFLAGS='' GOHOSTARCH='amd64' GOHOSTOS='linux' GOINSECURE='' GOMODCACHE='/home/h/go/pkg/mod' GONOPROXY='' GONOSUMDB='' GOOS='js' GOPATH='/home/h/go' GOPRIVATE='' GOPROXY='https://proxy.golang.org,direct' GOROOT='/usr/lib/go' GOSUMDB='sum.golang.org' GOTMPDIR='' GOTOOLCHAIN='auto' GOTOOLDIR='/usr/lib/go/pkg/tool/linux_amd64' GOVCS='' GOVERSION='go1.21.0' GCCGO='gccgo' GOWASM='' AR='ar' CC='gcc' CXX='g++' CGO_ENABLED='0' GOMOD='/home/h/code/pk/axesfull/go.mod' GOWORK='' CGO_CFLAGS='-O2 -g' CGO_CPPFLAGS='' CGO_CXXFLAGS='-O2 -g' CGO_FFLAGS='-O2 -g' CGO_LDFLAGS='-O2 -g' PKG_CONFIG='pkg-config' GOGCCFLAGS='-fPIC -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build4139731908=/tmp/go-build -gno-record-gcc-switches' uname -sr: Linux 6.4.8-arch1-1 LSB Version: n/a Distributor ID: Arch Description: Arch Linux Release: rolling Codename: n/a /usr/lib/libc.so.6: GNU C Library (GNU libc) stable release version 2.38.
What did you do?
NOTE: I only get these errors in Chromium based browsers, not in Firefox.
I have this following function:
type Account struct {
ID string `json:"id"`
}
func TestPersist(t *testing.T) {
fmt.Printf("runtime.Version(): %v\n", runtime.Version())
acc := Account{"5e7fd575-b5f5-4d7e-8fa7-70b5fef7662f"}
buf, _ := json.Marshal(acc)
r := bytes.NewBuffer(buf)
req, err := http.NewRequest("POST", "https://nk.axesfull.dev/v2/account/authenticate/device", r)
if err != nil {
t.Fatalf("could not create request: %v", err)
}
_, err = http.DefaultClient.Do(req)
if err != nil {
t.Fatalf("could not authenticate account: %v", err)
}
}
compiled with:
GOOS=js GOARCH=wasm go test -c -o test.wasm -run TestPersist
I ran this with the default wasm_exec.html
thats provided in $GOROOT/misc/wasm
with just adding test.v
to argv:
.
async function run() {
console.clear();
await go.run(inst);
go.arvc = ["js", "-test.v"]
inst = await WebAssembly.instantiate(mod, go.importObject); // reset instance
}
This works with go1.20, but not with go1.21.
Reproducible example available at https://github.com/jnowls/wasm-http-chrome - just run ./run.sh
What did you expect to see?
The browser successfully complete the request (as seen in Firefox and older versions of chrome)