Skip to content

Commit

Permalink
Add instructions to compile test2json without the need of a local go …
Browse files Browse the repository at this point in the history
…installation
  • Loading branch information
g-gaston committed Dec 30, 2021
1 parent 08a7689 commit 682d507
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions docs/running-without-go.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
`gotestsum` may be run without Go as long as the package to be tested has
already been compiled using `go test -c`, and the `test2json` tool is available.

The `test2json` tool can be compiled from the Go source tree:
The `test2json` tool can be compiled without installing go:

```sh
export GOVERSION=1.13.5
curl -Lo go.zip "https://github.com/golang/go/archive/go${GOVERSION}.zip"
unzip go.zip
rm -f go.zip
cd go-go${GOVERSION}/src/cmd/test2json/
env GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-s -w" .
GOVERSION=1.13.5
OS=$(uname -s | sed 's/.*/\L&/')
curl -L --silent https://go.dev/dl/go${GOVERSION}.${OS}-amd64.tar.gz | tar xz -C ./
env GOOS=linux GOARCH=amd64 CGO_ENABLED=0 ./go/bin/go build -o test2json -ldflags="-s -w" cmd/test2json
rm -rf go
mv test2json /usr/local/bin/test2json
```

Expand All @@ -27,4 +26,3 @@ Example: running without a Go installation
export GOVERSION=1.13
gotestsum --raw-command -- test2json -t -p pkgname ./binary.test -test.v
```

0 comments on commit 682d507

Please sign in to comment.