lint-filename.sh 644 B

123456789101112131415161718192021222324
  1. #!/usr/bin/env bash
  2. #
  3. # DO NOT EDIT THIS FILE
  4. #
  5. # It is automatically copied from https://github.com/pion/.goassets repository.
  6. #
  7. # If you want to update the shared CI config, send a PR to
  8. # https://github.com/pion/.goassets instead of this repository.
  9. #
  10. set -e
  11. SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
  12. GO_REGEX="^[a-zA-Z][a-zA-Z0-9_]*\.go$"
  13. find "$SCRIPT_PATH/.." -name "*.go" | while read fullpath; do
  14. filename=$(basename -- "$fullpath")
  15. if ! [[ $filename =~ $GO_REGEX ]]; then
  16. echo "$filename is not a valid filename for Go code, only alpha, numbers and underscores are supported"
  17. exit 1
  18. fi
  19. done