Standard library / crypto/x509/pkix

crypto/x509/pkix.Name.FillFromRDNSequence()

Fills a Name from distinguished-name attributes; not all attributes map to named fields. Expected stdout: 'Demo\n'.

Formal Syntax & Structure

go syntaxgo
func (n *Name) FillFromRDNSequence(rdns *RDNSequence)

Parameters & Attributes

NameTypeDescription
rdns*RDNSequenceDistinguished name sequence to convert.

Working Example

Example Snippetgo
package main
import (  "crypto/x509/pkix"  "fmt")
func main() {  n := pkix.Name{CommonName: "Demo"}  r := n.ToRDNSequence()  var out pkix.Name  out.FillFromRDNSequence(&r)  fmt.Println(out.CommonName)}
func must[T any](v T, e error) T {  if e != nil {    panic(e)  }  return v}func check(e error) {  if e != nil {    panic(e)  }}
Go Reference