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
32
32
if [[ $( sed -n 2p " $i " ) =~ " Copyright" ]]; then
33
33
echo " Remove the current boilerplate and add the new boilerplate to $i "
34
34
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.
36
36
elif [[ $( sed -n 1p " $i " ) =~ " //go:build" ]] && [[ $( sed -n 4p " $i " ) =~ " Copyright" ]]; then
37
37
echo " Remove the current boilerplate, copy the marker for Go, and add the new boilerplate to $i "
38
38
sed -e " 2,17d" " $i " > " $i .tmp"
@@ -42,7 +42,7 @@ for i in ${find_go_files}; do
42
42
cat " $i " > " $i .tmp"
43
43
fi
44
44
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.
46
46
if [[ $( sed -n 1p " $i .tmp" ) =~ " //go:build" ]]; then
47
47
(head -2 " $i .tmp" && cat ./hack/boilerplate/boilerplate.go.txt && tail -n +3 " $i .tmp" ) > " $i " && rm " $i .tmp"
48
48
# 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
19
19
20
20
cd " $( dirname " $0 " ) /.."
21
21
22
+ if ! which shellcheck > /dev/null; then
23
+ echo ' Can not find shellcheck, install with: make shellcheck'
24
+ exit 1
25
+ fi
26
+
22
27
shell_scripts=()
23
28
while IFS=' ' read -r script;
24
29
do git check-ignore -q " $script " || shell_scripts+=(" $script " );
25
30
done < <( find . -name " *.sh" \
26
- ! -path ./_\* \
27
- ! -path ./.git\*
31
+ ! -path " ./_* " \
32
+ ! -path " ./.git/* "
28
33
)
29
34
30
35
shellcheck " ${shell_scripts[@]} "
You can’t perform that action at this time.
0 commit comments