This PR adds the support necessary for a new struct tag redacted. If that tag is true, then the error string from the ParseError will have all occurrences of the value redacted
A couple of notes about this change:
It is not possible to just redact the value field, in the ParseError struct, because the value is also included (potentially) in the wrapped errors, so a call to err.Error() would still expose the value
Another approach could be to add a new error type, like RedactedParseError, but that would break the contract with the callers
It is important to note that this change is not redacting the var in memory, it is only redacting the output of the error message. The var can still be accessed through the Value field of the error object, and also through the wrapped errors (potentially)
This PR adds the support necessary for a new struct tag
redacted
. If that tag is true, then the error string from theParseError
will have all occurrences of the value redactedA couple of notes about this change:
ParseError
struct, because the value is also included (potentially) in the wrapped errors, so a call to err.Error() would still expose the valueRedactedParseError
, but that would break the contract with the callers