mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
./scripts/fix.sh: Takes care of goimports across the whole project.
Signed-off-by: Piotr Tabor <ptab@google.com>
This commit is contained in:
parent
1e14a0e31d
commit
5a28a02b97
@ -8,6 +8,8 @@ go mod tidy
|
||||
source ./scripts/test_lib.sh
|
||||
source ./scripts/updatebom.sh
|
||||
|
||||
ROOTDIR=`pwd`
|
||||
|
||||
# To fix according to newer version of go:
|
||||
# go get golang.org/dl/gotip
|
||||
# gotip download
|
||||
@ -29,11 +31,19 @@ function bash_ws_fix {
|
||||
find ./ -name '*.sh.bak' -print0 | xargs -0 rm
|
||||
}
|
||||
|
||||
log_callout -e "\\nFixing etcd code for you...\\n"
|
||||
function go_imports_fix {
|
||||
GOFILES=$(run ${GO_CMD} list --f '{{with $d:=.}}{{range .GoFiles}}{{$d.Dir}}/{{.}}{{"\n"}}{{end}}{{end}}' ./...)
|
||||
cd ${ROOTDIR}/tools/mod
|
||||
echo "$GOFILES" | grep -v '.gw.go' | grep -v '.pb.go' | xargs -n 100 go run golang.org/x/tools/cmd/goimports -w -local go.etcd.io
|
||||
}
|
||||
|
||||
log_callout -e "\\nFixing etcd code for you...\n"
|
||||
|
||||
run_for_modules mod_tidy_fix || exit 2
|
||||
run_for_modules run ${GO_CMD} fmt || exit 2
|
||||
run_for_module tests bom_fix || exit 2
|
||||
run_for_modules go_imports_fix || exit 2
|
||||
bash_ws_fix || exit 2
|
||||
|
||||
|
||||
log_success -e "\\nSUCCESS: etcd code is fixed :)"
|
||||
|
@ -51,7 +51,7 @@ if [ -n "${OUTPUT_FILE}" ]; then
|
||||
exec > >(tee -a "${OUTPUT_FILE}") 2>&1
|
||||
fi
|
||||
|
||||
PASSES=${PASSES:-"fmt bom dep build unit"}
|
||||
PASSES=${PASSES:-"gofmt bom dep build unit"}
|
||||
PKG=${PKG:-}
|
||||
SHELLCHECK_VERSION=${SHELLCHECK_VERSION:-"v0.8.0"}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user