Skip to content

proposal: crypto/tls, crypto/x509: use %w rather than %s in fmt.Errorf #77942

Description

@kanywst

Proposal Details

This is a proposal to update several fmt.Errorf calls in crypto/tls and crypto/x509 to use the %w verb instead of %s.

Rationale:
Currently, some error messages in these packages are formatted using %s. By changing them to %w, callers will be able to inspect the underlying errors using errors.Is and errors.As.

Implementation:
I have already uploaded a Gerrit CL for this change: https://go-review.googlesource.com/c/go/+/750300

Since making errors inspectable is effectively adding to the public API, I am opening this proposal to discuss whether this behavior change is desired and what kind of test/documentation updates are needed.

cc @golang/security

Metadata

Metadata

Assignees

No one assigned

    Labels

    LibraryProposalIssues describing a requested change to the Go standard library or x/ libraries, but not to a toolProposal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions