| 1 | // Copyright 2022 Google LLC |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package pbscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/ |
| 16 | |
| 17 | import ( |
| 18 | "bytesscip-go gomod github.com/golang/go/src go1.23.0 bytes/" |
| 19 | "reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/" |
| 20 | |
| 21 | "google.golang.org/protobuf/encoding/protowirescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/encoding/protowire`/" |
| 22 | "google.golang.org/protobuf/protoscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/" |
| 23 | "google.golang.org/protobuf/reflect/protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/" |
| 24 | |
| 25 | anypbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/anypb`/ "google.golang.org/protobuf/types/known/anypbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/anypb`/" |
| 26 | ) |
| 27 | |
| 28 | // Equal returns whether two proto.Message instances are equal using the following criteria: |
| 29 | // |
| 30 | // - Messages must share the same instance of the type descriptor |
| 31 | // - Known set fields are compared using semantics equality |
| 32 | // - Bytes are compared using bytes.Equal |
| 33 | // - Scalar values are compared with operator == |
| 34 | // - List and map types are equal if they have the same length and all elements are equal |
| 35 | // - Messages are equal if they share the same descriptor and all set fields are equal |
| 36 | // - Unknown fields are compared using byte equality |
| 37 | // - NaN values are not equal to each other |
| 38 | // - google.protobuf.Any values are unpacked before comparison |
| 39 | // - If the type descriptor for a protobuf.Any cannot be found, byte equality is used rather than |
| 40 | // semantic equality. |
| 41 | // |
| 42 | // This method of proto equality mirrors the behavior of the C++ protobuf MessageDifferencer |
| 43 | // whereas the golang proto.Equal implementation mirrors the Java protobuf equals() methods |
| 44 | // behaviors which needed to treat NaN values as equal due to Java semantics. |
| 45 | func Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/Equal().(x, y protoscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/.Messagescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/proto`/Message#) bool { |
| 46 | if x == nil || y == nil { |
| 47 | return x == nil && y == nil |
| 48 | } |
| 49 | xRef := x.ProtoReflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/ProtoMessage#ProtoReflect().() |
| 50 | yRef := y.ProtoReflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/ProtoMessage#ProtoReflect().() |
| 51 | return equalMessagescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/equalMessage().(xRef, yRef) |
| 52 | } |
| 53 | |
| 54 | func equalMessagescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/equalMessage().(mx, my protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.Messagescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Message#) bool { |
| 55 | // Note, the original proto.Equal upon which this implementation is based does not specifically handle the |
| 56 | // case when both messages are invalid. It is assumed that the descriptors will be equal and that byte-wise |
| 57 | // comparison will be used, though the semantics of validity are neither clear, nor promised within the |
| 58 | // proto.Equal implementation. |
| 59 | if mx.IsValidscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Message#IsValid().() != my.IsValidscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Message#IsValid().() || mx.Descriptorscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Message#Descriptor().() != my.Descriptorscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Message#Descriptor().() { |
| 60 | return false |
| 61 | } |
| 62 | |
| 63 | // This is an innovation on the default proto.Equal where protobuf.Any values are unpacked before comparison |
| 64 | // as otherwise the Any values are compared by bytes rather than structurally. |
| 65 | if isAnyscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/isAny().(mx) && isAnyscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/isAny().(my) { |
| 66 | ax := mx.Interfacescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Message#Interface().().(*anypbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/anypb`/.Anyscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/anypb`/Any#) |
| 67 | ay := my.Interfacescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Message#Interface().().(*anypbscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/anypb`/.Anyscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/anypb`/Any#) |
| 68 | // If the values are not the same type url, return false. |
| 69 | if ax.GetTypeUrlscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/anypb`/Any#GetTypeUrl().() != ay.GetTypeUrlscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/anypb`/Any#GetTypeUrl().() { |
| 70 | return false |
| 71 | } |
| 72 | // If the values are byte equal, then return true. |
| 73 | if bytesscip-go gomod github.com/golang/go/src go1.23.0 bytes/.Equalscip-go gomod github.com/golang/go/src go1.23.0 bytes/Equal().(ax.GetValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/anypb`/Any#GetValue().(), ay.GetValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/anypb`/Any#GetValue().()) { |
| 74 | return true |
| 75 | } |
| 76 | // Otherwise fall through to the semantic comparison of the any values. |
| 77 | x, err := ax.UnmarshalNewscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/anypb`/Any#UnmarshalNew().() |
| 78 | if err != nil { |
| 79 | return false |
| 80 | } |
| 81 | y, err := ay.UnmarshalNewscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/types/known/anypb`/Any#UnmarshalNew().() |
| 82 | if err != nil { |
| 83 | return false |
| 84 | } |
| 85 | // Recursively compare the unwrapped messages to ensure nested Any values are unwrapped accordingly. |
| 86 | return equalMessagescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/equalMessage().(x.ProtoReflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/ProtoMessage#ProtoReflect().(), y.ProtoReflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/ProtoMessage#ProtoReflect().()) |
| 87 | } |
| 88 | |
| 89 | // Walk the set fields to determine field-wise equality |
| 90 | nx := 0 |
| 91 | equal := true |
| 92 | mx.Rangescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Message#Range().(func(fd protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.FieldDescriptorscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/FieldDescriptor#, vx protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.Valuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Value#) bool { |
| 93 | nx++ |
| 94 | equal = my.Hasscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Message#Has().(fd) && equalFieldscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/equalField().(fd, vx, my.Getscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Message#Get().(fd)) |
| 95 | return equal |
| 96 | }) |
| 97 | if !equal { |
| 98 | return false |
| 99 | } |
| 100 | // Establish the count of set fields on message y |
| 101 | ny := 0 |
| 102 | my.Rangescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Message#Range().(func(protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.FieldDescriptorscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/FieldDescriptor#, protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.Valuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Value#) bool { |
| 103 | ny++ |
| 104 | return true |
| 105 | }) |
| 106 | // If the number of set fields is not equal return false. |
| 107 | if nx != ny { |
| 108 | return false |
| 109 | } |
| 110 | |
| 111 | return equalUnknownscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/equalUnknown().(mx.GetUnknownscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Message#GetUnknown().(), my.GetUnknownscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Message#GetUnknown().()) |
| 112 | } |
| 113 | |
| 114 | func equalFieldscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/equalField().(fd protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.FieldDescriptorscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/FieldDescriptor#, x, y protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.Valuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Value#) bool { |
| 115 | switch { |
| 116 | case fd.IsMapscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/FieldDescriptor#IsMap().(): |
| 117 | return equalMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/equalMap().(fd, x.Mapscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Value#Map().(), y.Mapscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Value#Map().()) |
| 118 | case fd.IsListscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/FieldDescriptor#IsList().(): |
| 119 | return equalListscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/equalList().(fd, x.Listscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Value#List().(), y.Listscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Value#List().()) |
| 120 | default: |
| 121 | return equalValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/equalValue().(fd, x, y) |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | func equalMapscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/equalMap().(fd protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.FieldDescriptorscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/FieldDescriptor#, x, y protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.Mapscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Map#) bool { |
| 126 | if x.Lenscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Map#Len().() != y.Lenscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Map#Len().() { |
| 127 | return false |
| 128 | } |
| 129 | equal := true |
| 130 | x.Rangescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Map#Range().(func(k protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.MapKeyscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/MapKey#, vx protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.Valuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Value#) bool { |
| 131 | vy := y.Getscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Map#Get().(k) |
| 132 | equal = y.Hasscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Map#Has().(k) && equalValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/equalValue().(fd.MapValuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/FieldDescriptor#MapValue().(), vx, vy) |
| 133 | return equal |
| 134 | }) |
| 135 | return equal |
| 136 | } |
| 137 | |
| 138 | func equalListscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/equalList().(fd protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.FieldDescriptorscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/FieldDescriptor#, x, y protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.Listscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/List#) bool { |
| 139 | if x.Lenscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/List#Len().() != y.Lenscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/List#Len().() { |
| 140 | return false |
| 141 | } |
| 142 | for i := x.Lenscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/List#Len().() - 1; i >= 0; i-- { |
| 143 | if !equalValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/equalValue().(fd, x.Getscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/List#Get().(i), y.Getscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/List#Get().(i)) { |
| 144 | return false |
| 145 | } |
| 146 | } |
| 147 | return true |
| 148 | } |
| 149 | |
| 150 | func equalValuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/equalValue().(fd protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.FieldDescriptorscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/FieldDescriptor#, x, y protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.Valuescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Value#) bool { |
| 151 | switch fd.Kindscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/FieldDescriptor#Kind().() { |
| 152 | case protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.BoolKindscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/BoolKind.: |
| 153 | return x.Boolscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Value#Bool().() == y.Boolscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Value#Bool().() |
| 154 | case protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.EnumKindscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/EnumKind.: |
| 155 | return x.Enumscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Value#Enum().() == y.Enumscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Value#Enum().() |
| 156 | case protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.Int32Kindscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Int32Kind., protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.Sint32Kindscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Sint32Kind., |
| 157 | protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.Int64Kindscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Int64Kind., protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.Sint64Kindscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Sint64Kind., |
| 158 | protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.Sfixed32Kindscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Sfixed32Kind., protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.Sfixed64Kindscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Sfixed64Kind.: |
| 159 | return x.Intscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Value#Int().() == y.Intscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Value#Int().() |
| 160 | case protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.Uint32Kindscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Uint32Kind., protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.Uint64Kindscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Uint64Kind., |
| 161 | protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.Fixed32Kindscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Fixed32Kind., protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.Fixed64Kindscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Fixed64Kind.: |
| 162 | return x.Uintscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Value#Uint().() == y.Uintscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Value#Uint().() |
| 163 | case protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.FloatKindscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/FloatKind., protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.DoubleKindscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/DoubleKind.: |
| 164 | return x.Floatscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Value#Float().() == y.Floatscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Value#Float().() |
| 165 | case protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.StringKindscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/StringKind.: |
| 166 | return x.Stringscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Value#String().() == y.Stringscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Value#String().() |
| 167 | case protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.BytesKindscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/BytesKind.: |
| 168 | return bytesscip-go gomod github.com/golang/go/src go1.23.0 bytes/.Equalscip-go gomod github.com/golang/go/src go1.23.0 bytes/Equal().(x.Bytesscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Value#Bytes().(), y.Bytesscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Value#Bytes().()) |
| 169 | case protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.MessageKindscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/MessageKind., protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.GroupKindscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/GroupKind.: |
| 170 | return equalMessagescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/equalMessage().(x.Messagescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Value#Message().(), y.Messagescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Value#Message().()) |
| 171 | default: |
| 172 | return x.Interfacescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Value#Interface().() == y.Interfacescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Value#Interface().() |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | func equalUnknownscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/equalUnknown().(x, y protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.RawFieldsscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/RawFields#) bool { |
| 177 | lenX := len(x) |
| 178 | lenY := len(y) |
| 179 | if lenX != lenY { |
| 180 | return false |
| 181 | } |
| 182 | if lenX == 0 { |
| 183 | return true |
| 184 | } |
| 185 | if bytesscip-go gomod github.com/golang/go/src go1.23.0 bytes/.Equalscip-go gomod github.com/golang/go/src go1.23.0 bytes/Equal().([]byte(x), []byte(y)) { |
| 186 | return true |
| 187 | } |
| 188 | |
| 189 | mx := make(map[protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.FieldNumberscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/FieldNumber#]protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.RawFieldsscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/RawFields#) |
| 190 | my := make(map[protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.FieldNumberscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/FieldNumber#]protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.RawFieldsscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/RawFields#) |
| 191 | for len(x) > 0 { |
| 192 | fnum, _, n := protowirescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/encoding/protowire`/.ConsumeFieldscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/encoding/protowire`/ConsumeField().(x) |
| 193 | mx[fnum] = append(mx[fnum], x[:n]...) |
| 194 | x = x[n:] |
| 195 | } |
| 196 | for len(y) > 0 { |
| 197 | fnum, _, n := protowirescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/encoding/protowire`/.ConsumeFieldscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/encoding/protowire`/ConsumeField().(y) |
| 198 | my[fnum] = append(my[fnum], y[:n]...) |
| 199 | y = y[n:] |
| 200 | } |
| 201 | return reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.23.0 reflect/DeepEqual().(mx, my) |
| 202 | } |
| 203 | |
| 204 | func isAnyscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/pb`/isAny().(m protoreflectscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/.Messagescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Message#) bool { |
| 205 | return string(m.Descriptorscip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Message#Descriptor().().FullNamescip-go gomod google.golang.org/protobuf v1.36.10 `google.golang.org/protobuf/reflect/protoreflect`/Descriptor#FullName().()) == "google.protobuf.Any" |
| 206 | } |