зеркало из https://github.com/golang/pkgsite.git
all.bash: add a check for abnormal migrations files
This catches the case where a rebase resulted in overlapping sequence numbers. Change-Id: I07e0a3729fabbbef895fae079ff70e8862201cd2 Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/460456 Reviewed-by: Julie Qiu <julieqiu@google.com>
This commit is contained in:
Родитель
27bbac7ffe
Коммит
17386b461f
15
all.bash
15
all.bash
|
@ -58,11 +58,22 @@ findcode() {
|
||||||
|
|
||||||
# Check that all .go and .sql files that have been staged in this commit have a
|
# Check that all .go and .sql files that have been staged in this commit have a
|
||||||
# license header.
|
# license header.
|
||||||
info "Running: Checking staged files for license header"
|
info "Checking staged files for license header"
|
||||||
checkheaders $(git diff --cached --name-only | grep -E ".go$|.sql$")
|
checkheaders $(git diff --cached --name-only | grep -E ".go$|.sql$")
|
||||||
info "Running: Checking internal files for license header"
|
info "Checking internal files for license header"
|
||||||
checkheaders $(findcode)
|
checkheaders $(findcode)
|
||||||
|
|
||||||
|
# Find migrations with bad sequence numbers, possibly resulting from a bad merge
|
||||||
|
bad_migrations() {
|
||||||
|
ls migrations | cut -d _ -f 1 | sort | uniq -c | grep -vE '^\s+2 '
|
||||||
|
}
|
||||||
|
|
||||||
|
info "Checking for bad migrations"
|
||||||
|
bad_migrations | while read line
|
||||||
|
do
|
||||||
|
err "unexpected number of migrations: $line"
|
||||||
|
done
|
||||||
|
|
||||||
# Download staticcheck if it doesn't exist
|
# Download staticcheck if it doesn't exist
|
||||||
if ! [ -x "$(command -v staticcheck)" ]; then
|
if ! [ -x "$(command -v staticcheck)" ]; then
|
||||||
info "Running: go get -u honnef.co/go/tools/cmd/staticcheck"
|
info "Running: go get -u honnef.co/go/tools/cmd/staticcheck"
|
||||||
|
|
Загрузка…
Ссылка в новой задаче