gotest.tools/gotestsum@v1.11.0/.project/docs/running-without-go.md (about) 1 # Running without Go 2 3 `gotestsum` may be run without Go as long as the package to be tested has 4 already been compiled using `go test -c`, and the `test2json` tool is available. 5 6 The `test2json` tool can be compiled from the Go source tree so that it can be distributed to the environment that needs it. 7 8 ```sh 9 GOVERSION=1.17.6 10 OS=$(uname -s | sed 's/.*/\L&/') 11 mkdir -p gopath 12 GOPATH=$(realpath gopath) 13 HOME=$(realpath ./) 14 curl -L --silent https://go.dev/dl/go${GOVERSION}.${OS}-amd64.tar.gz | tar xz -C ./ 15 env HOME=$HOME GOOS=linux GOARCH=amd64 CGO_ENABLED=0 GOPATH=$GOPATH ./go/bin/go build -o test2json -ldflags="-s -w" cmd/test2json 16 mv test2json /usr/local/bin/test2json 17 ``` 18 19 Or if you have Go installed already: 20 21 ```sh 22 env GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o test2json -ldflags="-s -w" cmd/test2json 23 mv test2json /usr/local/bin/test2json 24 ``` 25 26 Example: running without a Go installation 27 ``` 28 export GOVERSION=1.13 29 gotestsum --raw-command -- test2json -t -p pkgname ./binary.test -test.v 30 ``` 31 32 Note: Compiled test binaries *do not* cache test results, like the same `go test .` command would.