ci/check_go_fmt.sh
raw| 1 | #!/bin/bash |
| 2 | # This script is used by the CI to check if the code is gofmt formatted. |
| 3 | |
| 4 | set -euo pipefail |
| 5 | |
| 6 | GOFMT_DIFF=$(IFS=$'\n'; gofmt -d $( find . -type f -name '*.go' ) ) |
| 7 | if [[ -n "${GOFMT_DIFF}" ]]; then |
| 8 | echo "${GOFMT_DIFF}" |
| 9 | echo |
| 10 | echo "The go source files aren't gofmt formatted." |
| 11 | exit 1 |
| 12 | fi |