chore(makefile): 使用 goimports 替代 go fmt 格式化代码

goimports 可同时处理格式化和导入排序。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
xfy 2026-04-09 17:58:18 +08:00
parent ce43d5c1d6
commit 7a2b1d7e03

View File

@ -218,10 +218,15 @@ bench-check:
# 代码质量
# ============================================
# 格式化代码
# 格式化代码(使用 goimports 替代 go fmt
fmt:
@echo "Formatting code..."
go fmt ./...
@echo "Formatting code with goimports..."
@if command -v goimports >/dev/null 2>&1; then \
goimports -w .; \
else \
echo "goimports not installed. Run: go install golang.org/x/tools/cmd/goimports@latest"; \
exit 1; \
fi
# 静态检查
lint: