Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instructions to compile test2json without local go #226

Merged
merged 1 commit into from
Jan 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
```