From 77f8432d2fb6ebab328a7f9b8364a52edad86e14 Mon Sep 17 00:00:00 2001 From: Chris Bednarski Date: Thu, 31 Mar 2016 13:57:09 -0700 Subject: [PATCH] Improve performance of fmtcheck Previously gofmt would run even on files under vendor which we don't care about, and then discard the results. This approach instead selects only the files we want to pass into gofmt. - Before takes around 6.5 seconds - Now takes around 2 seconds --- scripts/gofmtcheck.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/gofmtcheck.sh b/scripts/gofmtcheck.sh index a89f042fd..1c055815f 100755 --- a/scripts/gofmtcheck.sh +++ b/scripts/gofmtcheck.sh @@ -2,7 +2,7 @@ # Check gofmt echo "==> Checking that code complies with gofmt requirements..." -gofmt_files=$(gofmt -l . | grep -v vendor) +gofmt_files=$(gofmt -l `find . -name '*.go' | grep -v vendor`) if [[ -n ${gofmt_files} ]]; then echo 'gofmt needs running on the following files:' echo "${gofmt_files}"