Alternative TLS implementation in Go
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

pre-commit 729 B

123456789101112131415161718192021222324252627
  1. #!/bin/sh
  2. # Copyright 2012 The Go Authors. All rights reserved.
  3. # Use of this source code is governed by a BSD-style
  4. # license that can be found in the LICENSE file.
  5. # git gofmt pre-commit hook
  6. #
  7. # To use, store as .git/hooks/pre-commit inside your repository and make sure
  8. # it has execute permissions.
  9. #
  10. # This script does not handle file names that contain spaces.
  11. gofiles=$(git diff --cached --name-only --diff-filter=ACM | grep '\.go$')
  12. [ -z "$gofiles" ] && exit 0
  13. unformatted=$(gofmt -l $gofiles)
  14. [ -z "$unformatted" ] && exit 0
  15. # Some files are not gofmt'd. Print message and fail.
  16. echo >&2 "Go files must be formatted with gofmt. Please run:"
  17. for fn in $unformatted; do
  18. echo >&2 " gofmt -w $PWD/$fn"
  19. done
  20. exit 1