From 5a246e0a718a547de7b167485e7f791595b5fa80 Mon Sep 17 00:00:00 2001 From: wenovus Date: Fri, 23 Jun 2023 14:17:09 -0700 Subject: [PATCH] simplify name --- gogen/unordered_list.go | 6 +++--- gogen/unordered_list_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gogen/unordered_list.go b/gogen/unordered_list.go index 55bbe325..0c1b4c59 100644 --- a/gogen/unordered_list.go +++ b/gogen/unordered_list.go @@ -519,13 +519,13 @@ func generateGetListKey(buf *bytes.Buffer, s *ygen.ParsedDirectory, nameMap map[ return goKeyMapTemplate.Execute(buf, h) } -// UnOrderedKeyedMapTypeName returns the map and key type names of an +// UnorderedMapTypeName returns the map and key type names of an // unordered, keyed map given go-generated IR information, as well as whether // it is a defined type rather than a Go built-in type. // // e.g. for a list to be represented as map[string]*Foo, it returns // "map[string]*Foo", "string", false, nil -func UnOrderedKeyedMapTypeName(listYANGPath, listFieldName, parentName string, goStructElements map[string]*ygen.ParsedDirectory) (string, string, bool, error) { +func UnorderedMapTypeName(listYANGPath, listFieldName, parentName string, goStructElements map[string]*ygen.ParsedDirectory) (string, string, bool, error) { // The list itself, since it is a container, has a struct associated with it. Retrieve // this from the set of Directory structs for which code (a Go struct) will be // generated such that additional details can be used in the code generation. @@ -609,7 +609,7 @@ func yangListFieldToGoType(listField *ygen.NodeDetails, listFieldName string, pa return fmt.Sprintf("[]*%s", listElem.Name), nil, nil, nil, nil } - listType, keyType, _, err := UnOrderedKeyedMapTypeName(listField.YANGDetails.Path, listFieldName, parent.Name, goStructElements) + listType, keyType, _, err := UnorderedMapTypeName(listField.YANGDetails.Path, listFieldName, parent.Name, goStructElements) if err != nil { return "", nil, nil, nil, err } diff --git a/gogen/unordered_list_test.go b/gogen/unordered_list_test.go index c7a58e61..62c6d79f 100644 --- a/gogen/unordered_list_test.go +++ b/gogen/unordered_list_test.go @@ -156,7 +156,7 @@ func TestUnOrderedKeyedMapTypeName(t *testing.T) { for _, tt := range tests { t.Run(tt.desc, func(t *testing.T) { - gotMapName, gotKeyName, gotIsDefined, err := UnOrderedKeyedMapTypeName(tt.inListYANGPath, tt.inListFieldName, tt.inParentName, tt.inGoStructElements) + gotMapName, gotKeyName, gotIsDefined, err := UnorderedMapTypeName(tt.inListYANGPath, tt.inListFieldName, tt.inParentName, tt.inGoStructElements) if diff := errdiff.Substring(err, tt.wantErrSubstr); diff != "" { t.Fatalf("did not get expected error, %s", diff) }