func fillTreeWithField(tree *tree, parent string, proto *descriptor.FieldDescriptorProto, loc string, locs map[string]*descriptor.SourceCodeInfo_Location) *field { key := fmt.Sprintf("%s.%s", parent, proto.GetName()) tree.fields[key] = &field{key: key, comment: getComment(loc, locs), FieldDescriptorProto: proto} if proto.GetLabel() == descriptor.FieldDescriptorProto_LABEL_REPEATED { tree.fields[key].repeated = true } if proto.OneofIndex != nil { if parent, ok := tree.messages[parent]; ok { for _, oneof := range parent.oneofs { if oneof.index == proto.GetOneofIndex() { oneof.fields = append(oneof.fields, tree.fields[key]) tree.fields[key].isOneOf = true } } } } return tree.fields[key] }