Skip to content

Commit dcb563d

Browse files
refactor: adjust codestyle to remove '+' in string concat
1 parent 208020f commit dcb563d

File tree

1 file changed

+21
-22
lines changed

1 file changed

+21
-22
lines changed

main.go

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,22 @@ import (
2929
)
3030

3131
var (
32-
globalName = "ca-controller-for-strimzi"
33-
scheme = runtime.NewScheme()
34-
log = ctrlRuntime.Log.WithName(globalName)
35-
reconcileAnnotationKey = "sebastian.gaiser.bayern/tls-strimzi-ca"
36-
reconcileAnnotationValue = "reconcile"
37-
managedByLabelKey = "sebastian.gaiser.bayern/managed-by"
38-
hashLabelKey = "sebastian.gaiser.bayern/hash"
39-
managedByLabelValue = "ca-controller-for-strimzi"
40-
targetClusterNameKey = "sebastian.gaiser.bayern/target-cluster-name"
41-
targetClusterNameValue = ""
42-
targetSecretAnnotationNameKey = "sebastian.gaiser.bayern/target-secret-name"
43-
targetSecretAnnotationKeyNameKey = "sebastian.gaiser.bayern/target-secret-key-name"
44-
strimziClusterLabel = "strimzi.io/cluster"
45-
strimziKindLabel = "strimzi.io/kind"
46-
strimziKindValue = "Kafka"
47-
strimziCaCertGeneration = "strimzi.io/ca-cert-generation"
48-
strimziCaKeyGeneration = "strimzi.io/ca-key-generation"
32+
globalName = "ca-controller-for-strimzi"
33+
scheme = runtime.NewScheme()
34+
log = ctrlRuntime.Log.WithName(globalName)
35+
reconcileAnnotationKey = "sebastian.gaiser.bayern/tls-strimzi-ca"
36+
reconcileAnnotationValue = "reconcile"
37+
managedByLabelKey = "sebastian.gaiser.bayern/managed-by"
38+
hashLabelKey = "sebastian.gaiser.bayern/hash"
39+
managedByLabelValue = "ca-controller-for-strimzi"
40+
targetClusterNameKey = "sebastian.gaiser.bayern/target-cluster-name"
41+
targetSecretAnnotationNameKey = "sebastian.gaiser.bayern/target-secret-name"
42+
targetSecretAnnotationKeyNameKey = "sebastian.gaiser.bayern/target-secret-key-name"
43+
strimziClusterLabel = "strimzi.io/cluster"
44+
strimziKindLabel = "strimzi.io/kind"
45+
strimziKindValue = "Kafka"
46+
strimziCaCertGeneration = "strimzi.io/ca-cert-generation"
47+
strimziCaKeyGeneration = "strimzi.io/ca-key-generation"
4948
)
5049

5150
func init() {
@@ -168,23 +167,23 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrlRuntime.Request) (ct
168167
return ctrlRuntime.Result{}, nil
169168
} else {
170169
if value == "" {
171-
ctrlRuntime.Log.Info("Secret with name: " + tlsSecret.Name + " should be reconciled but the target secret name annotation value is empty...")
170+
ctrlRuntime.Log.Info(fmt.Sprintf("Secret with name: %s should be reconciled but the target secret name annotation value is empty...", tlsSecret.Name))
172171
return ctrlRuntime.Result{}, nil
173172
} else {
174-
ctrlRuntime.Log.Info("Secret with name: " + tlsSecret.Name + " will get reconciled with target secret name: " + tlsSecretAnnotations[targetSecretAnnotationNameKey])
173+
ctrlRuntime.Log.Info(fmt.Sprintf("Secret with name: %s will get reconciled with target secret name: %s", tlsSecret.Name, tlsSecretAnnotations[targetSecretAnnotationNameKey]))
175174
}
176175
}
177176

178177
// verify targetSecretAnnotationKeyNameKey is set
179178
if value, exists := tlsSecretAnnotations[targetSecretAnnotationKeyNameKey]; !exists {
180-
ctrlRuntime.Log.Info("Secret with name: " + tlsSecret.Name + " should be reconciled but is missing annotation: " + targetSecretAnnotationKeyNameKey)
179+
ctrlRuntime.Log.Info(fmt.Sprintf("Secret with name: %s should be reconciled but is missing annotation: %s", tlsSecret.Name, targetSecretAnnotationKeyNameKey))
181180
return ctrlRuntime.Result{}, nil
182181
} else {
183182
if value == "" {
184-
ctrlRuntime.Log.Info("Secret with name: " + tlsSecret.Name + " should be reconciled but the target secret name key annotation value is empty...")
183+
ctrlRuntime.Log.Info(fmt.Sprintf("Secret with name: %s should be reconciled but the target secret name key annotation value is empty...", tlsSecret.Name))
185184
return ctrlRuntime.Result{}, nil
186185
} else {
187-
ctrlRuntime.Log.Info("Secret with name: " + tlsSecret.Name + " will get reconciled with target secret name: " + tlsSecretAnnotations[targetSecretAnnotationKeyNameKey])
186+
ctrlRuntime.Log.Info(fmt.Sprintf("Secret with name: %s will get reconciled with target secret name: %s", tlsSecret.Name, tlsSecretAnnotations[targetSecretAnnotationKeyNameKey]))
188187
}
189188
}
190189

0 commit comments

Comments
 (0)