NestedNameToExtension maps the Enums in the ContainerDescriptor to a map from nested name to extension Field. Returns error if extensions do not have unique nested names within the ContainerDescriptor, which should generally never happen for properly-formed ContainerDescriptors.
(containerDescriptor ContainerDescriptor)
| 697 | // ContainerDescriptor, which should generally never happen for properly-formed |
| 698 | // ContainerDescriptors. |
| 699 | func NestedNameToExtension(containerDescriptor ContainerDescriptor) (map[string]Field, error) { |
| 700 | nestedNameToExtension := make(map[string]Field) |
| 701 | if err := ForEachExtension( |
| 702 | func(extension Field) error { |
| 703 | nestedName := extension.NestedName() |
| 704 | if _, ok := nestedNameToExtension[nestedName]; ok { |
| 705 | return fmt.Errorf("duplicate extension: %q", nestedName) |
| 706 | } |
| 707 | nestedNameToExtension[nestedName] = extension |
| 708 | return nil |
| 709 | }, |
| 710 | containerDescriptor, |
| 711 | ); err != nil { |
| 712 | return nil, err |
| 713 | } |
| 714 | return nestedNameToExtension, nil |
| 715 | } |
| 716 | |
| 717 | // FullNameToEnum maps the Enums in the Files to a map from full name to enum. |
| 718 | // |
no test coverage detected
searching dependent graphs…