What version of Go are you using (go version)?
$ go version
go version devel go1.21-fe10464358 Fri May 5 13:20:58 2023 +0000 linux/amd64
Does this issue reproduce with the latest release?
No. After doing a git bisect, I have:
4c5d97990e4a39bd3e903f8e318b7234db3ba91f is the first bad commit
commit 4c5d97990e4a39bd3e903f8e318b7234db3ba91f
Author: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Date: Fri Jan 27 22:50:54 2023 -0800
net/http: disable fetch on NodeJS
which is the first commit breaking http requests in WASM.
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="..."
GOENV="..."
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="..."
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="..."
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="..."
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/.../go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="devel go1.21-fe10464358 Fri May 5 13:20:58 2023 +0000"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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 -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3099992878=/tmp/go-build -gno-record-gcc-switches"
What did you do?
Compile a WASM binary using:
GOOS=js GOARCH=wasm $GOROOT/bin/go build -o main.wasm main.go
then call from the WASM binary http.Client.Do which returns the following error:
http request error: Post "https://some.host/httpgrpc": dial tcp: lookup some.host: Protocol not available
What did you expect to see?
The http query to be executed.
What did you see instead?
An error saying that tcp is not available.
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
No. After doing a
git bisect, I have:which is the first commit breaking http requests in WASM.
What operating system and processor architecture are you using (
go env)?go envOutputWhat did you do?
Compile a WASM binary using:
then call from the WASM binary
http.Client.Dowhich returns the following error:What did you expect to see?
The http query to be executed.
What did you see instead?
An error saying that tcp is not available.