Skip to content

Commit

Permalink
Rename newDistinguisedNames to newExtraNames
Browse files Browse the repository at this point in the history
  • Loading branch information
maraino committed May 17, 2022
1 parent 005d309 commit c93d3e3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions x509util/name.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func newName(n pkix.Name) Name {
PostalCode: n.PostalCode,
SerialNumber: n.SerialNumber,
CommonName: n.CommonName,
ExtraNames: newDistinguisedNames(n.Names),
ExtraNames: newExtraNames(n.Names),
}
}

Expand Down Expand Up @@ -149,9 +149,9 @@ type DistinguishedName struct {
Value interface{} `json:"value"`
}

// newDistinguisedNames returns a list of DistinguishedName with the attributes not
// newExtraNames returns a list of DistinguishedName with the attributes not
// present in attributeTypeNames.
func newDistinguisedNames(atvs []pkix.AttributeTypeAndValue) []DistinguishedName {
func newExtraNames(atvs []pkix.AttributeTypeAndValue) []DistinguishedName {
var extraNames []DistinguishedName
for _, atv := range atvs {
if _, ok := attributeTypeNames[atv.Type.String()]; !ok {
Expand Down
4 changes: 2 additions & 2 deletions x509util/name_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ func TestIssuer_Set(t *testing.T) {
}
}

func Test_newDistinguisedNames(t *testing.T) {
func Test_newExtraNames(t *testing.T) {
type args struct {
atvs []pkix.AttributeTypeAndValue
}
Expand All @@ -476,7 +476,7 @@ func Test_newDistinguisedNames(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := newDistinguisedNames(tt.args.atvs); !reflect.DeepEqual(got, tt.want) {
if got := newExtraNames(tt.args.atvs); !reflect.DeepEqual(got, tt.want) {
t.Errorf("newDistinguisedNames() = %v, want %v", got, tt.want)
}
})
Expand Down

0 comments on commit c93d3e3

Please sign in to comment.