Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

all: simplify gofmt script #1777

Merged
merged 2 commits into from
Sep 24, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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' \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These directories were previously being ignored. Now they're being checked by gofmt. That doesn't sound right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, I meant to mention this in the description. vendor no longer exists. Having the docs folder included in the scan is fine, at least today. Looking at the git history of the file and previous PRs didn't tell me why so I can only theorize on why it was included. Maybe an older version of gofmt would error when there were no go files in it. That's what go fmt does today, although not gofmt.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. Yeah it's probably something like that. Pretty sure this was here for a reason in the past, but if it works now, that's great.

| xargs -I {} -P 4 gofmt -d {})
OUTPUT=$(gofmt -d .)

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