github.com/boson-project/source-to-image@v1.2.0/hack/verify-gofmt.sh (about) 1 #!/bin/bash 2 3 set -o errexit 4 set -o nounset 5 set -o pipefail 6 7 echo $(go version) 8 9 S2I_ROOT=$(dirname "${BASH_SOURCE}")/.. 10 source "${S2I_ROOT}/hack/util.sh" 11 12 cd "${S2I_ROOT}" 13 14 bad_files=$(s2i::util::find_files | xargs gofmt -s -l) 15 if [[ -n "${bad_files}" ]]; then 16 echo "!!! gofmt needs to be run on the following files: " >&2 17 echo "${bad_files}" 18 echo "Try running 'gofmt -s -d [path]'" >&2 19 echo "Or autocorrect with 'hack/verify-gofmt.sh | xargs -n 1 gofmt -s -w'" >&2 20 exit 1 21 fi