Created
June 2, 2021 22:04
-
-
Save howardjohn/c0f5d0bc293ef7d7fada533a2c9ffaf4 to your computer and use it in GitHub Desktop.
Compile all go tests, quickly, without running them
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage: go test -exec=true -toolexec=go-compile-without-link -vet=off ./... | |
# Preferably as an alias like `alias go-test-compile='go test -exec=true -toolexec=go-compile-without-link -vet=off'` | |
# This will compile all tests, but not link them (which is the least cacheable part) | |
if [[ "${2}" == "-V=full" ]]; then | |
"$@" | |
exit 0 | |
fi | |
case "$(basename ${1})" in | |
link) | |
# Output a dummy file | |
touch "${3}" | |
;; | |
# We could skip vet as well, but it can be done with -vet=off if desired | |
*) | |
"$@" | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment