Skip to content

proposal: crypto/x509: add MustParseOID function #81650

Open

Description

@printfn

Proposal Details

A x509.MustParseOID function would be useful for initialising OIDs in global variables, in the same vein as uuid.MustParse or regexp.MustCompile.

Sample implementation:

// MustParseOID is like [x509.ParseOID] but panics if the OID cannot be parsed.
func MustParseOID(s string) x509.OID {
	oid, err := x509.ParseOID(s)
	if err != nil {
		panic(err)
	}
	return oid
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions