Skip to content

Commit

Permalink
🐛 fix pre-commit hook
Browse files Browse the repository at this point in the history
Signed-off-by: Rintaro Okamura <rintaro.okamura@gmail.com>
  • Loading branch information
rinx committed Aug 27, 2020
1 parent 3512f48 commit 6f5bb4c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions hack/git/hooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
# limitations under the License.
#

TMPDIR=`mktemp -d`

if git diff HEAD^ --name-only | grep ".go$" > /dev/null; then
rm /tmp/go.mod /tmp/go.sum
cp go.mod /tmp
cp go.sum /tmp
cp go.mod ${TMPDIR}
cp go.sum ${TMPDIR}
# goimports
echo "Run goimports..."
find ./ -type f -regex ".*\.go" | xargs goimports -w
Expand All @@ -34,6 +35,6 @@ if git diff HEAD^ --name-only | grep ".go$" > /dev/null; then
golangci-lint run --fast --disable=gochecknoglobals --fix --color always -j 16 --skip-dirs apis/grpc --exclude-use-default=false ./...
echo "golangci-lint finished."
fi
mv -f /tmp/go.mod .
mv -f /tmp/go.sum .
mv -f ${TMPDIR}/go.mod .
mv -f ${TMPDIR}/go.sum .
fi

0 comments on commit 6f5bb4c

Please sign in to comment.