Move files back if linting fails (#810)
parent
b34fce0d85
commit
dc25fb6837
|
@ -29,8 +29,15 @@ echo "Installing golangci-lint..."
|
||||||
cp go.mod go.mod.bak && cp go.sum go.sum.bak
|
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
|
go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.19.1
|
||||||
|
|
||||||
|
# Run linting
|
||||||
echo "Looking for lint..."
|
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}
|
# 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
|
||||||
|
|
Loading…
Reference in New Issue