Skip to content

Commit f250a9c

Browse files
authored
🌱 (chore): group const declarations into blocks for clarity (#4669)
style: group const declarations into blocks for clarity Refactored standalone `const` declarations into grouped blocks in `kustomization_conversion_updater.go` and `generate_getting_started.go` to improve readability and align with Go style conventions.
1 parent 64ca4f4 commit f250a9c

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

hack/docs/internal/getting-started/generate_getting_started.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,14 +242,16 @@ func (sp *Sample) CodeGen() {
242242
hackutils.CheckError("Failed to enable helm plugin", err)
243243
}
244244

245-
const oldSpecAPI = "// Foo is an example field of Memcached. Edit memcached_types.go to remove/update\n\tFoo string `json:\"foo,omitempty\"`"
246-
const newSpecAPI = `// Size defines the number of Memcached instances
245+
const (
246+
oldSpecAPI = "// Foo is an example field of Memcached. Edit memcached_types.go to remove/update\n\tFoo string `json:\"foo,omitempty\"`"
247+
newSpecAPI = `// Size defines the number of Memcached instances
247248
// The following markers will use OpenAPI v3 schema to validate the value
248249
// More info: https://book.kubebuilder.io/reference/markers/crd-validation.html
249250
// +kubebuilder:validation:Minimum=1
250251
// +kubebuilder:validation:Maximum=3
251252
// +kubebuilder:validation:ExclusiveMaximum=false
252253
Size int32 ` + "`json:\"size,omitempty\"`"
254+
)
253255

254256
const oldStatusAPI = `// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
255257
// Important: Run "make" to regenerate code after modifying this file`

pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/kdefault/kustomization_conversion_updater.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ import (
2323
"sigs.k8s.io/kubebuilder/v4/pkg/machinery"
2424
)
2525

26-
const caNamespace = "crdkustomizecainjectionns"
27-
const caName = "crdkustomizecainjectionname"
26+
const (
27+
caNamespace = "crdkustomizecainjectionns"
28+
caName = "crdkustomizecainjectionname"
29+
)
2830

2931
// KustomizationCAConversionUpdater appends CA injection targets for CRDs with --conversion
3032
type KustomizationCAConversionUpdater struct {

0 commit comments

Comments
 (0)