I have go version go1.9beta1 linux/amd64 installed on ubuntu
I installed the go executable from the golang.org site
this is my go env :
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/dimitri/projects/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build366941307=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
While following the blog post "Running gofmt in Browser with 10 Lines of Code (Using GopherJS)" I get the following errors when I execute gopherjs build --minify. Any idea why it's failing?:
../../../../../../../../usr/local/go/src/runtime/error.go:134:3: undeclared name: throw ../../../../../../../../usr/local/go/src/runtime/error.go:136:12: undeclared name: CallersFrames ../../../../../../../../usr/local/go/src/runtime/error.go:144:3: undeclared name: throw ../../../../../../../../usr/local/go/src/runtime/error.go:148:3: undeclared name: throw ../../../../../../../../usr/local/go/src/runtime/error.go:153:3: undeclared name: throw ../../../../../../../../usr/local/go/src/runtime/error.go:156:3: undeclared name: throw
@Jimmy99 per @shurcooL's response this is most likely because you're using Go 1.9.
If you switch to Go 1.8.x does this fix things?
_Go 1.9 support will be merged via https://github.com/gopherjs/gopherjs/pull/651 shortly after Go 1.9 is officially released._
I thought that might be the problem. I will try with 1.8
Yes, the current master version of GopherJS requires Go 1.8.x. To use GopherJS with Go 1.9, you'll need to use its go1.9 branch, or wait until final release of Go 1.9 comes out, then go1.9 branch will be merged to master (as @myitcv said).
Also note you need to recompile the gopherjs binary after changing your Go version. GopherJS is a compiler that's closely tied to Go and uses the standard library in GOROOT, which is why this is the case.
I think we can help improve the situation by detecting when the installed Go version doesn't match the gopherjs binary and print a more helpful error message. I filed #671 to track that.
Also filed #672 to consider using a different approach, one that wouldn't suffer from this issue altogether (but has other costs that may not make it worth it).
Most helpful comment
@Jimmy99 per @shurcooL's response this is most likely because you're using Go 1.9.
If you switch to Go 1.8.x does this fix things?
_Go 1.9 support will be merged via https://github.com/gopherjs/gopherjs/pull/651 shortly after Go 1.9 is officially released._