From eddf01dd794518399f077b1e3c34d1789c1a8984 Mon Sep 17 00:00:00 2001 From: attacker Date: Thu, 2 Jul 2026 08:26:56 +0800 Subject: [PATCH] =?UTF-8?q?fix(build):=20go:embed=20all:static=20=E7=BC=96?= =?UTF-8?q?=E8=AF=91=E9=98=BB=E5=A1=9E=E4=BF=AE=E5=A4=8D=20=E2=80=94=20.gi?= =?UTF-8?q?tignore=20=E5=85=81=E8=AE=B8=20.gitkeep=20=E5=8D=A0=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 问题: backend/static/ 在 .gitignore 中忽略整个目录,导致 .gitkeep 无法被 git 追踪。全新 clone 后 go build ./... 报错: 'pattern all:static: cannot embed directory static: contains no embeddable files' 修复: - .gitignore: backend/static/ → backend/static/* + !backend/static/.gitkeep - 新增 backend/static/.gitkeep 占位文件(go:embed 需要至少一个可嵌入文件) 验证: go build ./... ✅ | tsc -b ✅ | npm build ✅(21s) | 17/17 集成测试 ✅ 质量: any=37 unused=2 console=0 --- .gitignore | 4 +++- backend/static/.gitkeep | 0 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 backend/static/.gitkeep diff --git a/.gitignore b/.gitignore index 76f2fab..b5e1613 100644 --- a/.gitignore +++ b/.gitignore @@ -82,7 +82,9 @@ agent/aiops-agent agent/bin/ # embed 模式临时目录(前端构建产物,编译后清理) -backend/static/ +# 保留 .gitkeep 占位文件确保 go:embed all:static 在全新 clone 后可编译 +backend/static/* +!backend/static/.gitkeep backend/cmd/static/ # Hermes agent config (personal, not project) diff --git a/backend/static/.gitkeep b/backend/static/.gitkeep new file mode 100644 index 0000000..e69de29