Skip to content

Commit

Permalink
all: simplify gofmt script (stellar#1777)
Browse files Browse the repository at this point in the history
Remove the ls xargs dance from the gofmt and just get gofmt to run it's checks over everything of what's different.

I was looking at copying this script to another repository and noticed that the dance with excluding certain folders and piping to xargs to run in parallel is really not necessary.

I'm not making this change to improve the performance of this, because I don't think it's meaningful right here, but just mentioning this for completeness that when I run the script as it is now sharing across 4 processes it was actually marginally slower than just running gofmt once like this change does. So this change isn't introducing a slowdown in CI runtime.
  • Loading branch information
leighmcculloch authored Sep 24, 2019
1 parent 5a68852 commit b0f8cf4
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions gofmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
set -e

printf "Running gofmt checks...\n"
OUTPUT=$(ls -d */ \
| egrep -v '^vendor|^docs' \
| xargs -I {} -P 4 gofmt -d {})
OUTPUT=$(gofmt -d .)

if [[ $OUTPUT ]]; then
printf "gofmt found unformatted files:\n\n"
Expand Down

0 comments on commit b0f8cf4

Please sign in to comment.