Simplify to just use an exit code

This commit is contained in:
Andrew Morgan 2019-10-08 14:14:12 +01:00
parent dfbcf927f5
commit 9a9aa79a99

View file

@ -31,13 +31,13 @@ go get github.com/golangci/golangci-lint/cmd/golangci-lint
# Run linting # Run linting
echo "Looking for lint..." echo "Looking for lint..."
# If we're running locally, continue the script even if linting fails
if [ -z ${CI+x} ]; then # Capture exit code to ensure go.{mod,sum} is restored before exiting
golangci-lint run $args || echo "Linting script failed, removing module backups" exit_code=0
else
# Otherwise, a linting fail should fail the CI step golangci-lint run $args || exit_code=1
golangci-lint run $args
fi
# Restore go.{mod,sum} # Restore go.{mod,sum}
mv go.mod.bak go.mod && mv go.sum.bak go.sum mv go.mod.bak go.mod && mv go.sum.bak go.sum
exit $exit_code