From 9a9aa79a99d690172bf1565b4b66298faa2f66f0 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Tue, 8 Oct 2019 14:14:12 +0100 Subject: [PATCH] Simplify to just use an exit code --- scripts/find-lint.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/find-lint.sh b/scripts/find-lint.sh index e80908e27..e454855b7 100755 --- a/scripts/find-lint.sh +++ b/scripts/find-lint.sh @@ -31,13 +31,13 @@ go get github.com/golangci/golangci-lint/cmd/golangci-lint # Run linting echo "Looking for lint..." -# If we're running locally, continue the script even if linting fails -if [ -z ${CI+x} ]; then - golangci-lint run $args || echo "Linting script failed, removing module backups" -else - # Otherwise, a linting fail should fail the CI step - golangci-lint run $args -fi + +# Capture exit code to ensure go.{mod,sum} is restored before exiting +exit_code=0 + +golangci-lint run $args || exit_code=1 # Restore go.{mod,sum} mv go.mod.bak go.mod && mv go.sum.bak go.sum + +exit $exit_code