etcd/scripts/fix.sh
Piotr Tabor 6e800b9b01
20201103 no commit title check (#12447)
* Turn off checking of format of commit message.

* scripts/fix.sh: Fix fixing whitespaces in *.sh scripts

Aparently there is a difference between:
  find ./ -print0 -name *.sh and
  find ./ -name *.sh -print0

* etcdserver unit tests: Do not call .Fatalf(...) from not test's goroutine.

Fixes following test failures:
https://travis-ci.com/github/etcd-io/etcd/jobs/425920416
```
% (cd server && go vet ./...)
stderr: # go.etcd.io/etcd/server/v3/etcdserver
stderr: etcdserver/server_test.go:1002:4: call to (*T).Fatalf from a non-test goroutine
stderr: etcdserver/server_test.go:1166:4: call to (*T).Fatalf from a non-test goroutine
FAIL: (code:2):
  % (cd server && go vet ./...)
FAIL: 'run go vet ./...' checking failed (!=0 return code)
FAIL: 'govet' failed at Tue Nov  3 04:07:47 UTC 2020
```
2020-11-03 07:59:42 -08:00

28 lines
726 B
Bash
Executable File

#!/usr/bin/env bash
set -e
source ./scripts/test_lib.sh
source ./scripts/updatebom.sh
function mod_tidy_fix {
run rm ./go.sum
run go mod tidy || return 2
}
function bash_ws_fix {
log_callout "Fixing whitespaces in the bash scripts"
# Makes sure all bash scripts do use ' ' (double space) for indention.
log_cmd "find ./ -name '*.sh' -print0 | xargs -0 sed --follow-symlinks -i 's|\t| |g'"
find ./ -name '*.sh' -print0 | xargs -0 sed --follow-symlinks -i 's|\t| |g'
}
log_callout -e "\nFixing etcd code for you...\n"
run_for_modules run go fmt || exit 2
run_for_modules mod_tidy_fix || exit 2
run_for_module tests bom_fix || exit 2
bash_ws_fix || exit 2
log_success -e "\nSUCCESS: etcd code is fixed :)"