Skip to content

Commit

Permalink
simplify name
Browse files Browse the repository at this point in the history
  • Loading branch information
wenovus committed Jun 23, 2023
1 parent b3adb50 commit 5a246e0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions gogen/unordered_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion gogen/unordered_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 5a246e0

Please sign in to comment.