From 2985ee210b00c8bd75dd37a0f4f7f417ab20e3c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Fri, 1 Feb 2019 22:12:44 +0000 Subject: [PATCH] _js: improve build script First, make it check that the 'go' command is the version we require. Second, use 'go run' to execute gopherjs, which means the developer doesn't need to run 'go install' first, nor pollute their $PATH with the gopherjs version we need. --- _js/build | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/_js/build b/_js/build index ead9c9f95..05beec628 100755 --- a/_js/build +++ b/_js/build @@ -1,13 +1,13 @@ #!/bin/sh -# If you get weird errors like 'undeclared name: CacheLinePadSize', try being -# explicit about the Go 1.11.x GOROOT, like: -# -# GOROOT=/usr/lib/go ./build +if ! go version | grep go1.11; then + echo "Go 1.11.x required to build." + exit 1 +fi export GO111MODULE=on # build in module-aware mode -gopherjs build -o index.js || exit 1 +go run github.com/gopherjs/gopherjs build -o index.js || exit 1 node testmain.js || exit 1