golang/go

html/template: default missingkey behavior does not match documentation

Open

#54.053 aperta il 25 lug 2022

Vedi su GitHub
 (3 commenti) (0 reazioni) (0 assegnatari)Go (19.008 fork)batch import
DocumentationNeedsInvestigationhelp wanted

Metriche repository

Star
 (133.883 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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>

Guida contributor