Closed
Description
What version of Go are you using (go version
)?
$ go version go version go1.17.2 darwin/amd64
Does this issue reproduce with the latest release?
Yes. It's caused by the latest release.
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/Users/evan/Library/Caches/go-build" GOENV="/Users/evan/Library/Application Support/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/evan/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/evan/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64" GOVCS="" GOVERSION="go1.17.2" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/evan/dev/esbuild/go.mod" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/j6/np400cw17sz0n5ljd67byrzw0000gn/T/go-build2118346093=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
Here's a simple way to reproduce the issue:
$ echo 'package main;import"fmt";func main(){fmt.Println(0)}' > main.go
$ GOOS=js GOARCH=wasm go build -o main.wasm main.go
$ X=longlonglonglong && X="$X$X$X$X" && X="$X$X$X$X" && X="$X$X$X$X" && X="$X$X$X$X" node $(go env GOROOT)/misc/wasm/wasm_exec.js main.wasm
What did you expect to see?
This should print 0
.
What did you see instead?
This fails with the following error:
Error: command line too long
at global.Go.run (/usr/local/go/misc/wasm/wasm_exec.js:574:11)
at /usr/local/go/misc/wasm/wasm_exec.js:630:14
There are at least two problems:
-
With Go 1.17.2, it's now impossible to use Go WASM programs in situations with many environment variables. This comes up when trying to run something via GitHub Actions, for example.
-
The error message
command line too long
is confusing because there are no command-line arguments. Instead the problem is that there are too many environment variables.