golang/go

html/template: default missingkey behavior does not match documentation

Open

#54,053 opened on 2022年7月25日

GitHub で見る
 (3 comments) (0 reactions) (0 assignees)Go (19,008 forks)batch import
DocumentationNeedsInvestigationhelp wanted

Repository metrics

Stars
 (133,883 stars)
PR merge metrics
 (30d に merged 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>

コントリビューターガイド