25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 

34 satır
958 B

  1. #!/bin/bash
  2. # Fail on any error
  3. set -eo pipefail
  4. # Display commands being run
  5. set -x
  6. # Only run the linter on go1.12, since it needs type aliases (and we only care
  7. # about its output once).
  8. if [[ `go version` != *"go1.12"* ]]; then
  9. exit 0
  10. fi
  11. go install \
  12. github.com/golang/protobuf/protoc-gen-go \
  13. golang.org/x/tools/cmd/goimports
  14. # Fail if a dependency was added without the necessary go.mod/go.sum change
  15. # being part of the commit.
  16. go mod tidy
  17. git diff go.mod | tee /dev/stderr | (! read)
  18. git diff go.sum | tee /dev/stderr | (! read)
  19. # Easier to debug CI.
  20. pwd
  21. # Look at all .go files (ignoring .pb.go files) and make sure they have a Copyright. Fail if any don't.
  22. git ls-files "*[^.pb].go" | xargs grep -L "\(Copyright [0-9]\{4,\}\)" 2>&1 | tee /dev/stderr | (! read)
  23. gofmt -s -d -l . 2>&1 | tee /dev/stderr | (! read)
  24. goimports -l . 2>&1 | tee /dev/stderr | (! read)
  25. # No need to golint / staticcheck when it's just proto-generated files