diff options
author | Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> | 2019-12-25 18:14:58 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-25 18:14:58 +0000 |
commit | dc25fb6837f4e301d572b71d2f480f0c052a399c (patch) | |
tree | 1eccf97a93e68f1118d03afa8ece08ef3649d586 | |
parent | b34fce0d85be4626fcc9d7ffaa110aca148cdb4b (diff) |
Move files back if linting fails (#810)
-rwxr-xr-x | scripts/find-lint.sh | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/scripts/find-lint.sh b/scripts/find-lint.sh index ca991b62..c9663e4e 100755 --- a/scripts/find-lint.sh +++ b/scripts/find-lint.sh @@ -29,8 +29,15 @@ echo "Installing golangci-lint..." cp go.mod go.mod.bak && cp go.sum go.sum.bak go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.19.1 +# Run linting echo "Looking for lint..." -golangci-lint run $args + +# 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 |