checkstyle-go.sh 380 B

123456789101112131415
  1. #!/bin/sh -e
  2. # Check if the style of the Go source files is correct without modifying those
  3. # files.
  4. # The grep is needed because `goimports -d` and `gofmt -d` always exits with 0.
  5. echo 'Go files need these changes:'
  6. if find . -name '*.go' | xargs goimports -d | grep .; then
  7. exit 1
  8. fi
  9. if find . -name '*.go' | xargs gofmt -s -d | grep .; then
  10. exit 1
  11. fi
  12. echo ' None!'