github.com/ggriffiths/terraform@v0.9.0-beta1.0.20170222213024-79c4935604cb/scripts/gofmtcheck.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  # Check gofmt
     4  echo "==> Checking that code complies with gofmt requirements..."
     5  gofmt_files=$(gofmt -l `find . -name '*.go' | grep -v vendor`)
     6  if [[ -n ${gofmt_files} ]]; then
     7      echo 'gofmt needs running on the following files:'
     8      echo "${gofmt_files}"
     9      echo "You can use the command: \`make fmt\` to reformat code."
    10      exit 1
    11  fi
    12  
    13  exit 0