shell scripts: shfmt

This commit is contained in:
Motiejus Jakštys 2024-05-10 16:10:29 +03:00
parent e393a36a65
commit 5aa28f74ee
2 changed files with 7 additions and 2 deletions

View File

@ -16,6 +16,8 @@ lint:
go vet ./...
staticcheck -f stylish ./...
shellcheck $(SCRIPTS)
shfmt $(SCRIPTS)
git diff --exit-code
.INTERMEDIATE: coverage.out
coverage.out: $(GODEPS)

View File

@ -1,12 +1,15 @@
#!/usr/bin/env bash
set -euo pipefail
_err(){ >&2 echo "ERROR: $*"; exit 1; }
_err() {
echo >&2 "ERROR: $*"
exit 1
}
git status --porcelain | grep -q "" &&
_err "working tree is dirty, commit your changes first."
[[ "$1" =~ ^v([0-9]+)\.([0-9]+)(\.([0-9]+))?(-rc([0-9]+))?$ ]] || \
[[ "$1" =~ ^v([0-9]+)\.([0-9]+)(\.([0-9]+))?(-rc([0-9]+))?$ ]] ||
_err "arg1 accepts the following formats: v1.0 v1.0.0 v1.0-rc1 v1.0.1-rc1"
git tag | grep -q "^$1$" &&