1#!/bin/bash 2 3files=$(find . -name "*.go" | grep -v vendor/ | xargs gofmt -l -s) 4if [[ $files ]]; then 5 echo "Gofmt errors in files:" 6 echo "$files" 7 diff=$(find . -name "*.go" | grep -v vendor/ | xargs gofmt -d -s) 8 echo "$diff" 9 exit 1 10fi