proposal: text/template: add more details to ExecError #71801
Labels
LibraryProposal
Issues describing a requested change to the Go standard library or x/ libraries, but not to a tool
Proposal
Milestone
Proposal Details
Hello all,
I would like to propose that the ExecError type found in text/template tracks more fields than just the name of the template and the error message which includes the template:
https://cs.opensource.google/go/go/+/refs/tags/go1.23.6:src/text/template/exec.go;l=114-147
I would like to propose that we introduce additional fields to include the location of the error (as in the line number and column number), a version of the error message string that does not include the template name, and the "context" (which means the executed function call). The proposed error type would look like the following:
The reason that I am proposing these changes to the struct is because I am helping out with a downstream repository helm (https://github.com/helm/helm). I want to introduce a change to improve their error message formats.
issue in helm: helm/helm#13447
PR to helm: helm/helm#13586
In my PR to helm, I found that I needed to introduce string manipulation logic to extract these fields that are already captured, but not saved, inside the text/template error state.
Does this proposal make sense?
Thanks
The text was updated successfully, but these errors were encountered: