Go 1.10 added a new flag failfast
to go test:
The new go test -failfast
flag disables running additional tests after any test fails. Note that tests running in parallel with the failing test are allowed to complete.
However, note this does not work across packages: https://github.com/golang/go/issues/33038
Here’s a workaround:
for s in $(go list ./...); do if ! go test -failfast -v -p 1 $s; then break; fi; done