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

Co-authored-by: Daniel Nephin <dnephin@gmail.com>
  • Loading branch information
g-gaston and dnephin committed Jan 18, 2022
1 parent 08a7689 commit 42e50c2
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions docs/running-without-go.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
`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 from the Go source tree so that it can be distributed to the environment that needs it.

```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.17.6
OS=$(uname -s | sed 's/.*/\L&/')
mkdir -p gopath
GOPATH=$(realpath gopath)
HOME=$(realpath ./)
curl -L --silent https://go.dev/dl/go${GOVERSION}.${OS}-amd64.tar.gz | tar xz -C ./
env HOME=$HOME GOOS=linux GOARCH=amd64 CGO_ENABLED=0 GOPATH=$GOPATH ./go/bin/go build -o test2json -ldflags="-s -w" cmd/test2json
mv test2json /usr/local/bin/test2json
```

Expand All @@ -27,4 +28,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 42e50c2

Please sign in to comment.