-
Notifications
You must be signed in to change notification settings - Fork 468
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Our codebase is already sufficiently formatted, so we can enable **`gofumpt` by default**. This PR also merges `lint-typo`, `lint-fix-typo`, `format`, `lint-format`, and `lint` Makefile targets into a single `lint` target to ease the software development process. `codespell` CI job is removed in favor of `lint` job. Closes #604 --------- Co-authored-by: Greg Szabo <[email protected]>
- Loading branch information
1 parent
e8b4efa
commit e9637ad
Showing
12 changed files
with
1,538 additions
and
1,545 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
# Format staged Go files with `gofumpt` | ||
|
||
# Get the list of staged Go files. | ||
files=$(git diff --cached --name-only --diff-filter=ACMR | grep '\.go$') | ||
|
||
# Check if gofumpt is installed. | ||
if ! command -v gofumpt &> /dev/null; then | ||
echo "Error: gofumpt is not installed. Please install it by running 'go install mvdan.cc/gofumpt@latest'" >&2 | ||
exit 1 | ||
fi | ||
|
||
# Check if there are Go files to format. | ||
if [ -n "$files" ]; then | ||
echo "Running gofumpt on staged Go files:" | ||
for file in $files; do | ||
gofumpt -l -w "$file" | ||
git add "$file" | ||
done | ||
fi | ||
|
||
# Continue with the regular commit process. | ||
exit 0 |
Oops, something went wrong.