Skip to content

Commit 1194ece

Browse files
committed
upkeep: overkill med reflect
1 parent 2f80f91 commit 1194ece

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

pkg/aiven/aiven_services/kafka.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ package aiven_services
22

33
import (
44
"fmt"
5-
"reflect"
65
"strings"
76

8-
"github.com/nais/liberator/pkg/apis/aiven.nais.io/v1"
7+
aiven_nais_io_v1 "github.com/nais/liberator/pkg/apis/aiven.nais.io/v1"
98
)
109

1110
type KafkaPool int64
@@ -61,5 +60,5 @@ func (k *Kafka) Generate(generator SecretGenerator) error {
6160
}
6261

6362
func (k *Kafka) Is(other Service) bool {
64-
return reflect.TypeOf(other) == reflect.TypeOf(k)
63+
return k.Name() == other.Name()
6564
}

pkg/aiven/aiven_services/opensearch.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ package aiven_services
22

33
import (
44
"fmt"
5-
"reflect"
65
"strings"
76

8-
"github.com/nais/liberator/pkg/apis/aiven.nais.io/v1"
7+
aiven_nais_io_v1 "github.com/nais/liberator/pkg/apis/aiven.nais.io/v1"
98
)
109

1110
type OpenSearchAccess int64
@@ -65,5 +64,5 @@ func (o *OpenSearch) Generate(generator SecretGenerator) error {
6564
}
6665

6766
func (o *OpenSearch) Is(other Service) bool {
68-
return reflect.TypeOf(other) == reflect.TypeOf(o)
67+
return o.Name() == other.Name()
6968
}

0 commit comments

Comments
 (0)