build-check 578 B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/bash -e
  2. #
  3. # Run all go-iptables tests
  4. # ./test
  5. # ./test -v
  6. #
  7. # Run tests for one package
  8. # PKG=./unit ./test
  9. # PKG=ssh ./test
  10. #
  11. # Invoke ./cover for HTML output
  12. COVER=${COVER:-"-cover"}
  13. source ./build
  14. FORMATTABLE="iptables"
  15. # user has not provided PKG override
  16. if [ -z "$PKG" ]; then
  17. FMT=$FORMATTABLE
  18. # user has provided PKG override
  19. else
  20. # strip out slashes and dots from PKG=./foo/
  21. FMT=${PKG//\//}
  22. fi
  23. echo "Checking gofmt..."
  24. fmtRes=$(gofmt -l $FMT)
  25. if [ -n "${fmtRes}" ]; then
  26. echo -e "gofmt checking failed:\n${fmtRes}"
  27. exit 255
  28. fi
  29. echo "Success"