github.com/resonatecoop/id@v1.1.0-43/run_basic_checks.sh (about)

     1  #!/usr/bin/env bash
     2  set -e
     3  
     4  # get relevant source files
     5  SOURCES=$(find ./ -iname "*.go")
     6  if [ -z "$SOURCES" ]; then
     7    exit 0
     8  fi
     9  
    10  # track which files need to be formated
    11  TOFORMAT=$(gofmt -l $SOURCES)
    12  if [ -z "$TOFORMAT" ]; then
    13    exit 0
    14  fi
    15  
    16  # print which files need to be formatted
    17  echo >&2 "Go files must be formatted with gofmt. Please run:"
    18  for FILE in $TOFORMAT; do
    19  	echo >&2 "  gofmt -w $FILE"
    20  done
    21  exit 23