Skip to content

Commit 1cca5ee

Browse files
committed
Golint only on changed files
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 6733962 commit 1cca5ee

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

hack/make/validate-lint

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22

33
source "${MAKEDIR}/.validate"
44

5-
packages=( $(go list ./... 2> /dev/null | grep -vE "^github.com/docker/docker/vendor|^github.com/docker/docker/autogen" || true ) )
5+
IFS=$'\n'
6+
files=( $(validate_diff --diff-filter=ACMR --name-only -- '*.go' | grep -v '^vendor/' || true) )
7+
unset IFS
68

79
errors=()
8-
for p in "${packages[@]}"; do
9-
# Remove the github.com/docker/docker/ prefix from listed package
10-
package="${p#github.com/docker/docker/}"
11-
# Run golint on package/*.go file explicitly to validate all go files
12-
# and not just the ones for the current platform.
13-
failedLint=$(golint $package/*.go)
10+
for f in "${files[@]}"; do
11+
# we use "git show" here to validate that what's committed passes go vet
12+
failedLint=$(golint "$f")
1413
if [ "$failedLint" ]; then
1514
errors+=( "$failedLint" )
1615
fi

0 commit comments

Comments
 (0)