File tree 2 files changed +5
-5
lines changed
2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -317,6 +317,7 @@ setup-pre-commit:
317
317
@cp .git/hooks/pre-commit .git/hooks/pre-commit.bak 2> /dev/null || true
318
318
@echo " Installing pre-commit hook..."
319
319
@ln -sf ../../scripts/hooks/pre-commit.sh .git/hooks/pre-commit
320
+ @echo " Pre-commit hook was installed at .git/hooks/pre-commit"
320
321
321
322
# ? lint: Run golangci-lint on all modules
322
323
lint :
Original file line number Diff line number Diff line change @@ -22,12 +22,11 @@ function check_golangci_lint_version(){
22
22
}
23
23
24
24
function lint_and_add_modified_go_files() {
25
- local go_files=" $( git diff --name-only --diff-filter=d | grep \. go$ | grep -v \. pb\. go$) "
26
- for f in $go_files ; do
27
- local dir_name=" $( dirname $f ) "
25
+ local go_file_dirs=" $( git diff --name-only --diff-filter=d | grep \. go$ | grep -v \. pb\. go$ | xargs dirname | sort | uniq) "
26
+ for dir_name in $go_file_dirs ; do
28
27
golangci-lint run " ${dir_name} " --fix --out-format=tab --issues-exit-code=0
29
- echo " adding ${f } to git index"
30
- git add $f
28
+ echo " adding ${dir_name } to git index"
29
+ git add $dir_name
31
30
done
32
31
}
33
32
You can’t perform that action at this time.
0 commit comments