diff --git a/run-go-critic.sh b/run-go-critic.sh index 09ca79f..3cd8ff5 100755 --- a/run-go-critic.sh +++ b/run-go-critic.sh @@ -1,2 +1,15 @@ #!/usr/bin/env bash -exec gocritic check ./... + +failed=false + +for file in "$@"; do + # redirect stderr so that violations and summaries are properly interleaved. + if ! gocritic check "$file" 2>&1 + then + failed=true + fi +done + +if [[ $failed == "true" ]]; then + exit 1 +fi