Ver código fonte

test: speedup and strengthen go vet checking

Was iterating over every file, reloading everything. Instead,
analyze the package directories. On my machine, the time for
vet checking goes from 34s to 3s. Scans more code too.
Anthony Romano 9 anos atrás
pai
commit
482a7839d9
1 arquivos alterados com 7 adições e 11 exclusões
  1. 7 11
      test

+ 7 - 11
test

@@ -213,17 +213,13 @@ function fmt_pass {
 		exit 255
 		exit 255
 	fi
 	fi
 
 
-	echo "Checking 'go tool vet -shadow'..."
-	for path in $FMT; do
-		if [ "${path##*.}" != "go" ]; then
-			path="${path}/*.go"
-		fi
-		vetRes=$(go tool vet -shadow ${path})
-		if [ -n "${vetRes}" ]; then
-			echo -e "govet -shadow checking ${path} failed:\n${vetRes}"
-			exit 255
-		fi
-	done
+	echo "Checking 'go tool vet -all -shadow'..."
+	fmtpkgs=$(echo $FMT | xargs dirname | sort | uniq | sed '/\./d')
+	vetRes=$(go tool vet -all -shadow ${fmtpkgs} 2>&1 | grep -v '/gw/' || true)
+	if [ -n "${vetRes}" ]; then
+		echo -e "govet -all -shadow checking failed:\n${vetRes}"
+		exit 255
+	fi
 
 
 	echo "Checking documentation style..."
 	echo "Checking documentation style..."
 	# eschew you
 	# eschew you