#!/bin/sh
unformatted=$(gofmt -l -s .)

exec 1>&2

if [ -n "$unformatted" ]; then
  echo "The following Go files are not formatted:"
  echo "$unformatted"
  echo
  echo "Please run 'gofmt -s -w .' to format them before committing."
  exit 1
fi

exit 0