x/text: avoid double execution of lookup in lookupAndFormat() #29136
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Performance
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
//go:generate gotext -srclang=en update -out=catalog/catalog.go -lang=fr
message.lookupAndFormat()
until this fragment:What did you expect to see?
id == msg
, skip the second execution ofp.catContext(msg)
if the first execution returnedcatalog.ErrNotFound
What did you see instead?
p.catContext.Execute(id)
returnedcatalog.ErrNotFound
, code performs the same work a second time asp.catContext.Execute(msg)
id == msg
, maybe like:The text was updated successfully, but these errors were encountered: