Skip to content

Commit

Permalink
references: avoid using reflect when comparing GoUUID
Browse files Browse the repository at this point in the history
Signed-off-by: Jaime Caamaño Ruiz <jcaamano@redhat.com>
  • Loading branch information
jcaamano committed Jan 23, 2024
1 parent bb2f6df commit 690361f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions updates/references.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package updates

import (
"fmt"
"reflect"

"github.com/ovn-org/libovsdb/database"
"github.com/ovn-org/libovsdb/model"
Expand Down Expand Up @@ -424,13 +423,13 @@ func (rt *referenceTracker) processWeakReferences() (ModelUpdates, error) {
return updates, nil
}

func copyMapKeyValues(from, to map[interface{}]interface{}, isKey bool, keyValue interface{}) map[interface{}]interface{} {
func copyMapKeyValues(from, to map[interface{}]interface{}, isKey bool, keyValue ovsdb.UUID) map[interface{}]interface{} {
if isKey {
to[keyValue] = from[keyValue]
return to
}
for key, value := range from {
if reflect.DeepEqual(value, keyValue) {
if value.(ovsdb.UUID) == keyValue {
to[key] = from[key]
}
}
Expand Down

0 comments on commit 690361f

Please sign in to comment.