Skip to content

Commit

Permalink
add MustParseDN function
Browse files Browse the repository at this point in the history
  • Loading branch information
merlinz01 committed Apr 15, 2024
1 parent df1f286 commit af972a3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions dn.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,16 @@ func ParseDN(s string) (DN, error) {
return dn, nil
}

// Parses a RFC4514 string representation into a DN.
// Panics if there is an error, useful for compile-time initialization.
func MustParseDN(s string) DN {
dn, err := ParseDN(s)
if err != nil {
panic(err)
}
return dn
}

// Split a DN string into its RDNs, taking into account escaped commas and reversing the order.
func splitRDNs(s string) []string {
if s == "" {
Expand Down

0 comments on commit af972a3

Please sign in to comment.