I'm building a go module targeting Wasm that I need to test.
Current configuration
The travis.yml
config:
language: go
go:
- 1.11.x
before_install:
- curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
- dep ensure
And the following makefile
:
all: deps test
deps:
GOOS=js GOARCH=wasm go get ./...
test:
GOOS=js GOARCH=wasm go test ./...
test-cover:
$(GOPATH)/bin/mockgen -source=dom/dom.go -destination=mock/dom.go -package=mock
$(GOPATH)/bin/mockgen -source=vnode.go -destination=mock/node.go -package=mock
GOOS=js GOARCH=wasm go test ./... -coverprofile=cover.out
go tool cover -html=cover.out
And my go env
:
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/marvinfrachet/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/marvinfrachet/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/t0/7bv6yclx1d913wtl6rdsvjtr0000gn/T/go-build435765871=/tmp/go-build -gno-record-gcc-switches -fno-common"
The problem
On my build, I'm having the following error:
GOOS=js GOARCH=wasm go get ./...
GOOS=js GOARCH=wasm go test ./...
fork/exec /tmp/go-build540008292/b001/go-vdom-wasm.test: exec format error
FAIL github.com/mfrachet/go-vdom-wasm 0.004s
? github.com/mfrachet/go-vdom-wasm/dom [no test files]
fork/exec /tmp/go-build540008292/b118/helpers.test: exec format error
FAIL github.com/mfrachet/go-vdom-wasm/helpers 0.005s
? github.com/mfrachet/go-vdom-wasm/mock [no test files]
https://travis-ci.org/mfrachet/go-vdom-wasm
On a locale machine, it's working great and my tests all pass.
I think the problem is due to the GOOS=js
that doesn't seem to be understood.