chore(makefile): 使用 goimports 替代 go fmt 格式化代码
goimports 可同时处理格式化和导入排序。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
ce43d5c1d6
commit
7a2b1d7e03
11
Makefile
11
Makefile
@ -218,10 +218,15 @@ bench-check:
|
|||||||
# 代码质量
|
# 代码质量
|
||||||
# ============================================
|
# ============================================
|
||||||
|
|
||||||
# 格式化代码
|
# 格式化代码(使用 goimports 替代 go fmt)
|
||||||
fmt:
|
fmt:
|
||||||
@echo "Formatting code..."
|
@echo "Formatting code with goimports..."
|
||||||
go fmt ./...
|
@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:
|
lint:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user