Browse code

Golint only on changed files

Signed-off-by: Vincent Demeester <vincent@sbr.pm>

Vincent Demeester authored on 2015/09/09 16:37:47
Showing 1 changed files
... ...
@@ -2,15 +2,14 @@
2 2
 
3 3
 source "${MAKEDIR}/.validate"
4 4
 
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
6 8
 
7 9
 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")
14 13
 	if [ "$failedLint" ]; then
15 14
 		errors+=( "$failedLint" )
16 15
 	fi