From deea56fde398cc490a5aebd7cb44aa27d95bf7d1 Mon Sep 17 00:00:00 2001 From: tenzen-y Date: Mon, 2 May 2022 00:24:59 +0900 Subject: [PATCH] fix comment --- hack/boilerplate/update-boilerplate.sh | 4 ++-- hack/verify-shellcheck.sh | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/hack/boilerplate/update-boilerplate.sh b/hack/boilerplate/update-boilerplate.sh index 2b6aa5c1899..aa4ec011a9f 100755 --- a/hack/boilerplate/update-boilerplate.sh +++ b/hack/boilerplate/update-boilerplate.sh @@ -32,7 +32,7 @@ for i in ${find_go_files}; do if [[ $(sed -n 2p "$i") =~ "Copyright" ]]; then echo "Remove the current boilerplate and add the new boilerplate to $i" tail -n +17 "$i" >"$i.tmp" - # If the 1st line starts with "//go:build" and the 2nd line starts with "Copyright", remove the current boilerplate and copy the marker for Go. + # If the 1st line starts with "//go:build" and the 4th line starts with "Copyright", remove the current boilerplate and copy the marker. elif [[ $(sed -n 1p "$i") =~ "//go:build" ]] && [[ $(sed -n 4p "$i") =~ "Copyright" ]]; then echo "Remove the current boilerplate, copy the marker for Go, and add the new boilerplate to $i" sed -e "2,17d" "$i" > "$i.tmp" @@ -42,7 +42,7 @@ for i in ${find_go_files}; do cat "$i" >"$i.tmp" fi - # If the 1st line starts with "//go:build", copy the marker for Go and add the new boilerplate to the file. + # If the 1st line starts with "//go:build", copy the marker and add the new boilerplate to the file. if [[ $(sed -n 1p "$i.tmp") =~ "//go:build" ]]; then (head -2 "$i.tmp" && cat ./hack/boilerplate/boilerplate.go.txt && tail -n +3 "$i.tmp") >"$i" && rm "$i.tmp" # Otherwise, add the new boilerplate to the file. diff --git a/hack/verify-shellcheck.sh b/hack/verify-shellcheck.sh index 4da1533fb18..4b05ab22947 100755 --- a/hack/verify-shellcheck.sh +++ b/hack/verify-shellcheck.sh @@ -19,12 +19,17 @@ set -o pipefail cd "$(dirname "$0")/.." +if ! which shellcheck >/dev/null; then + echo 'Can not find shellcheck, install with: make shellcheck' + exit 1 +fi + shell_scripts=() while IFS='' read -r script; do git check-ignore -q "$script" || shell_scripts+=("$script"); done < <(find . -name "*.sh" \ - ! -path ./_\* \ - ! -path ./.git\* + ! -path "./_*" \ + ! -path "./.git/*" ) shellcheck "${shell_scripts[@]}"