Browse code

change tabs to spaces

Signed-off-by: Jessica Frazelle <jess@docker.com>

Jessica Frazelle authored on 2015/04/14 03:31:17
Showing 1 changed files
... ...
@@ -6,17 +6,27 @@ IFS=$'\n'
6 6
 files=( $(validate_diff --diff-filter=ACMR --name-only -- '*.go' | grep -v '^vendor/' || true) )
7 7
 unset IFS
8 8
 
9
+errors=()
9 10
 for f in "${files[@]}"; do
10
-    # we use "git show" here to validate that what's committed is vetted
11
-    failedVet=$(git show "$VALIDATE_HEAD:$f" | go vet)
12
-    if [ $failedVet ]; then
13
-        fails=yes
14
-        echo $failedVet
15
-    fi
11
+	# we use "git show" here to validate that what's committed passes go vet
12
+	failedVet=$(go vet "$f")
13
+	if [ "$failedVet" ]; then
14
+		errors+=( "$failedVet" )
15
+	fi
16 16
 done
17 17
 
18
-if [ $fails ]; then
19
-    echo 'Please review and resolve the above issues and commit the result.'
18
+
19
+if [ ${#errors[@]} -eq 0 ]; then
20
+	echo 'Congratulations!  All Go source files have been vetted.'
20 21
 else
21
-    echo 'All Go source files have been vetted.'
22
+	{
23
+		echo "Errors from go vet:"
24
+		for err in "${errors[@]}"; do
25
+			echo " - $err"
26
+		done
27
+		echo
28
+		echo 'Please fix the above errors. You can test via "go vet" and commit the result.'
29
+		echo
30
+	} >&2
31
+	false
22 32
 fi