golang/go

html/template: default missingkey behavior does not match documentation

Open

#54,053 创建于 2022年7月25日

在 GitHub 查看
 (3 评论) (0 反应) (0 负责人)Go (19,008 fork)batch import
DocumentationNeedsInvestigationhelp wanted

仓库指标

Star
 (133,883 star)
PR 合并指标
 (30 天内没有已合并 PR)

描述

What version of Go are you using (go version)?

Does this issue reproduce with the latest release?

Yes.

What did you do?

https://go.dev/play/p/i3N0a5PATuI

What did you expect to see?

<b><no value></b>

This would align with the documented behavior of Template.Option.

"missingkey=default" or "missingkey=invalid" The default behavior: Do nothing and continue execution. If printed, the result of the index operation is the string "".

This is what text/template outputs.

What did you see instead?

<b></b>

贡献者指南