chore(gofmt): 配套——.gitignore 收 cron_raw.txt + Makefile 加 fmt-check 校验

- cron_raw.txt(10-09 hermes cron list dump,无引用/从未入库/可随时重现)
  → 进 .gitignore 忽略,保留数据不删
- Makefile 加 fmt-check target:gofmt -l 非空即 fail,日常/CI 一键查格式
  (只在已有 Makefile 载体上加,不新建机制;go fmt 不支持 -l,用独立 gofmt)
独立于格式化 commit 886c0c2,避免夹带。
This commit is contained in:
小唯
2026-10-10 15:55:31 +08:00
parent 886c0c20e2
commit 82ef904257
2 changed files with 13 additions and 0 deletions
+3
View File
@@ -35,3 +35,6 @@ bin/
# 构建产物(worker 曾把 7.9M 二进制留在工作区,2026-09-21)
go/zhiyi-cli
go/zhiyid
# 临时工件(cron list dump,随时可 `hermes cron list` 重现,不入库)
cron_raw.txt
+10
View File
@@ -6,6 +6,7 @@
# ─── 变量 ────────────────────────────────────────────
GO_CMD := go
RUST_CMD := cargo
GOFMT_CMD := gofmt
GO_DIR := go
RUST_DIR := rust
BINARY_GO := $(GO_DIR)/cmd/zhiyid/zhiyid
@@ -81,6 +82,15 @@ deploy-compose: docker-build
test:
cd $(GO_DIR) && $(GO_CMD) test ./... -v -count=1
# 格式校验:gofmt 不合规即报错(gofmt -l 列出文件 → 非空则 exit 1)
fmt-check:
@cd $(GO_DIR) && $(GOFMT_CMD) -l . | tee /tmp/.gofmt_files > /dev/null; \
if [ -s /tmp/.gofmt_files ]; then \
echo "❌ gofmt 不合规文件($(GOFMT_CMD) -l . 非空):"; \
$(GOFMT_CMD) -l . ; \
echo " 修复: cd $(GO_DIR) && $(GOFMT_CMD) -w ."; exit 1; \
else echo "✅ gofmt 合规(0 文件)"; fi
test-go: test
test-rust: