Files
tamabox/.workbuddy/memory/topics/embed.md
T
2026-10-21 12:09:28 +08:00

1.2 KiB
Raw Blame History

行尾 / 模板 / embed(长版明细)

行尾 / 模板 / embed

  • 行尾混合不可推断(internal/db/*、mail.go、route/user/profile.go 是 LF;internal/route/route.go、 users.go、i18n/dict_*.go、route/question/*.go、base.css、dev/theme-builder/* 是 CRLF)。 改前用 Python 数 b'\r\n';gofmt -l 会把 CRLF 误报为未格式化 → 走 dev/gofmt_keep_crlf.py。 Edit 工具会保留原文件行尾,可放心用;新增整份文件用 Write 时要自己补 CRLF。
  • 往 gofmt 对齐组中间插键会污染 diff,新键插组末;注释别用 ''(gofmt 改成 ”)。
  • ⚠️ templates/embed.go 是显式清单:新增顶层模板必须加进 //go:embed,否则运行时 html/template: "xxx" is undefined → 500,编译期无提示。static/fs.go 同理。
  • ⚠️ //go:embed 的 * 不匹配 _ / . 开头的文件:static/css/themes/_scaffold.css 与 临时建的 _gentest.css 都不进 embed,TestDecoSlotCount 扫不到它们(表现是"校验了但数字没变")。 验证生成的主题 CSS 要临时改成非下划线文件名。
  • templates/user/moderation-strictness.html 只用 shell/python 改(Edit/Write 会注入 data-page-node-id)。