mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-13 01:50:55 +00:00
Tweak pre-commit to ignore vendor directory.
This commit is contained in:
@@ -1,5 +1,13 @@
|
||||
#!/bin/bash
|
||||
# Runs pre-commit tests.
|
||||
#
|
||||
# Instead of failing on first error, complete all checks, then fail if need be.
|
||||
|
||||
# Echo go's version to verify against go's behavior below.
|
||||
# Different versions do different things with respect to vendored code.
|
||||
go version
|
||||
|
||||
# Assert state.
|
||||
if [ -n "$failIt" ]; then
|
||||
echo "Expecting failIt to be empty."
|
||||
exit 1
|
||||
@@ -7,25 +15,25 @@ fi
|
||||
|
||||
wantEmpty=$(gofmt -s -d -l . 2>&1 )
|
||||
if [ -n "$wantEmpty" ]; then
|
||||
printf >&2 'gofmt failed for:\n%s\n' "$wantEmpty"
|
||||
printf >&2 '\ngofmt failed for:\n%s\n' "$wantEmpty"
|
||||
failIt=1
|
||||
fi
|
||||
|
||||
wantEmpty=$(goimports -l .)
|
||||
wantEmpty=$(goimports -l $(find . -type f -name '*.go' -not -path "./vendor/*") 2>&1)
|
||||
if [ -n "$wantEmpty" ]; then
|
||||
printf >&2 'goimports failed for:\n%s\n' "$wantEmpty"
|
||||
printf >&2 '\ngoimports failed for:\n%s\n' "$wantEmpty"
|
||||
failIt=1
|
||||
fi
|
||||
|
||||
wantEmpty=$(go vet -all ./... 2>&1)
|
||||
if [ -n "$wantEmpty" ]; then
|
||||
printf >&2 'govet failed for:\n%s\n' "$wantEmpty"
|
||||
printf >&2 '\ngo vet failed for:\n%s\n' "$wantEmpty"
|
||||
failIt=1
|
||||
fi
|
||||
|
||||
wantEmpty=$(golint ./...)
|
||||
if [ -n "$wantEmpty" ]; then
|
||||
printf >&2 'golint failed for:\n%s\n' "$wantEmpty"
|
||||
printf >&2 '\ngolint failed for:\n%s\n' "$wantEmpty"
|
||||
failIt=1
|
||||
fi
|
||||
|
||||
@@ -35,3 +43,4 @@ if [ -n "$failIt" ]; then
|
||||
fi
|
||||
|
||||
go test -v ./...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user