File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ for i in ${find_go_files}; do
3232 if [[ $( sed -n 2p " $i " ) =~ " Copyright" ]]; then
3333 echo " Remove the current boilerplate and add the new boilerplate to $i "
3434 tail -n +17 " $i " > " $i .tmp"
35- # 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 .
35+ # If the 1st line starts with "//go:build" and the 4th line starts with "Copyright", remove the current boilerplate and copy the marker.
3636 elif [[ $( sed -n 1p " $i " ) =~ " //go:build" ]] && [[ $( sed -n 4p " $i " ) =~ " Copyright" ]]; then
3737 echo " Remove the current boilerplate, copy the marker for Go, and add the new boilerplate to $i "
3838 sed -e " 2,17d" " $i " > " $i .tmp"
@@ -42,7 +42,7 @@ for i in ${find_go_files}; do
4242 cat " $i " > " $i .tmp"
4343 fi
4444
45- # If the 1st line starts with "//go:build", copy the marker for Go and add the new boilerplate to the file.
45+ # If the 1st line starts with "//go:build", copy the marker and add the new boilerplate to the file.
4646 if [[ $( sed -n 1p " $i .tmp" ) =~ " //go:build" ]]; then
4747 (head -2 " $i .tmp" && cat ./hack/boilerplate/boilerplate.go.txt && tail -n +3 " $i .tmp" ) > " $i " && rm " $i .tmp"
4848 # Otherwise, add the new boilerplate to the file.
Original file line number Diff line number Diff line change @@ -19,12 +19,17 @@ set -o pipefail
1919
2020cd " $( dirname " $0 " ) /.."
2121
22+ if ! which shellcheck > /dev/null; then
23+ echo ' Can not find shellcheck, install with: make shellcheck'
24+ exit 1
25+ fi
26+
2227shell_scripts=()
2328while IFS=' ' read -r script;
2429 do git check-ignore -q " $script " || shell_scripts+=(" $script " );
2530done < <( find . -name " *.sh" \
26- ! -path ./_\* \
27- ! -path ./.git\*
31+ ! -path " ./_* " \
32+ ! -path " ./.git/* "
2833)
2934
3035shellcheck " ${shell_scripts[@]} "
You can’t perform that action at this time.
0 commit comments