summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/spf13/pflag/verify/gofmt.sh
blob: f66acf803b54c1a72bdbdece69a4ab064ade838b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash

set -o errexit
set -o nounset
set -o pipefail

ROOT=$(dirname "${BASH_SOURCE}")/..

pushd "${ROOT}" > /dev/null

GOFMT=${GOFMT:-"gofmt"}
bad_files=$(find . -name '*.go' | xargs $GOFMT -s -l)
if [[ -n "${bad_files}" ]]; then
  echo "!!! '$GOFMT' needs to be run on the following files: "
  echo "${bad_files}"
  exit 1
fi

# ex: ts=2 sw=2 et filetype=sh