Skip to content

Commit

Permalink
make make pretty actually fix imports
Browse files Browse the repository at this point in the history
Signed-off-by: Andres Taylor <[email protected]>
  • Loading branch information
systay committed Nov 25, 2024
1 parent c0e528a commit 8f059b7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ clean:
# Pretty: formats the code using gofumpt and goimports-reviser
pretty: check-tools
@echo "Running formatting tools..."
@gofumpt -l -w . >/dev/null 2>&1 || true
@goimports-reviser -project-name $$(go list -m) -rm-unused -set-alias -format . >/dev/null 2>&1 || true
@gofumpt -w . >/dev/null 2>&1
@goimports-reviser -recursive -project-name $$(go list -m) -rm-unused -set-alias ./go >/dev/null 2>&1

# Tools installation command
install-tools:
Expand Down
8 changes: 4 additions & 4 deletions git-hooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ for file in $GO_FILES; do
}
done

# 2. Run goimports-reviser to verify formatting on changed files (without writing changes)
echo "Checking goimports-reviser formatting..."
# Check imports with goimports-reviser
echo "Checking goimports-reviser imports..."
for file in $GO_FILES; do
goimports-reviser -project-name $(go list -m) -rm-unused -set-alias -format "$file" -diff >/dev/null 2>&1
goimports-reviser -project-name $(go list -m) -rm-unused -set-alias "$file" >/dev/null 2>&1
if [[ $? -ne 0 ]]; then
echo "Error: Imports not correctly formatted in $file. Please run 'make pretty'."
echo "Error: Imports not correctly organized in $file. Please run 'make pretty'."
exit 1
fi
done
Expand Down
1 change: 0 additions & 1 deletion go/summarize/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"testing"

"github.com/stretchr/testify/assert"

"github.com/stretchr/testify/require"
)

Expand Down

0 comments on commit 8f059b7

Please sign in to comment.