1.2 KiB
1.2 KiB
行尾 / 模板 / 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)。