From 82ef90425757184f71922287b420553f3a83db44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=94=AF?= Date: Sat, 10 Oct 2026 15:55:31 +0800 Subject: [PATCH] =?UTF-8?q?chore(gofmt):=20=E9=85=8D=E5=A5=97=E2=80=94?= =?UTF-8?q?=E2=80=94.gitignore=20=E6=94=B6=20cron=5Fraw.txt=20+=20Makefile?= =?UTF-8?q?=20=E5=8A=A0=20fmt-check=20=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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,避免夹带。 --- .gitignore | 3 +++ Makefile | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/.gitignore b/.gitignore index 459413d..158edbd 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/Makefile b/Makefile index bf5449d..8430fab 100644 --- a/Makefile +++ b/Makefile @@ -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: