Skip to content

Commit 2ae3760

Browse files
committed
Enable omitzero modernize linter rule
Signed-off-by: Erik Godding Boye <[email protected]>
1 parent 1c1c618 commit 2ae3760

7 files changed

+25
-15
lines changed

.golangci.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ linters:
1414
paths: [third_party, builtin$, examples$]
1515
warn-unused: true
1616
settings:
17-
modernize:
18-
disable:
19-
# TODO(erikgb): Enable when we know how to do this correctly in API types
20-
- omitzero
2117
staticcheck:
2218
checks: ["all", "-ST1000", "-ST1001", "-ST1003", "-ST1005", "-ST1012", "-ST1016", "-ST1020", "-ST1021", "-ST1022", "-QF1001", "-QF1003", "-QF1008"]
2319
enable:

api/v1beta1/googlecasclusterissuer_types.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ import (
2929
// +kubebuilder:subresource:status
3030
// GoogleCASClusterIssuer is the Schema for the googlecasclusterissuers API
3131
type GoogleCASClusterIssuer struct {
32-
metav1.TypeMeta `json:",inline"`
33-
metav1.ObjectMeta `json:"metadata,omitempty"`
32+
metav1.TypeMeta `json:",inline"`
33+
// +optional
34+
metav1.ObjectMeta `json:"metadata"`
3435

35-
Spec GoogleCASIssuerSpec `json:"spec,omitempty"`
36-
Status v1alpha1.IssuerStatus `json:"status,omitempty"`
36+
Spec GoogleCASIssuerSpec `json:"spec"`
37+
// +optional
38+
Status v1alpha1.IssuerStatus `json:"status,omitzero"`
3739
}
3840

3941
func (vi *GoogleCASClusterIssuer) GetConditions() []metav1.Condition {
@@ -50,7 +52,8 @@ var _ v1alpha1.Issuer = &GoogleCASClusterIssuer{}
5052
// GoogleCASClusterIssuerList contains a list of GoogleCASClusterIssuer
5153
type GoogleCASClusterIssuerList struct {
5254
metav1.TypeMeta `json:",inline"`
53-
metav1.ListMeta `json:"metadata,omitempty"`
55+
// +optional
56+
metav1.ListMeta `json:"metadata"`
5457
Items []GoogleCASClusterIssuer `json:"items"`
5558
}
5659

api/v1beta1/googlecasissuer_types.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ type GoogleCASIssuerSpec struct {
4141

4242
// Credentials is a reference to a Kubernetes Secret Key that contains Google Service Account Credentials
4343
// +optional
44-
Credentials cmmetav1.SecretKeySelector `json:"credentials,omitempty"`
44+
Credentials cmmetav1.SecretKeySelector `json:"credentials,omitzero"`
4545

4646
// CertificateTemplate is specific certificate template to
4747
// use. Omit to not specify a template
@@ -56,11 +56,13 @@ type GoogleCASIssuerSpec struct {
5656
// +kubebuilder:subresource:status
5757
// GoogleCASIssuer is the Schema for the googlecasissuers API
5858
type GoogleCASIssuer struct {
59-
metav1.TypeMeta `json:",inline"`
60-
metav1.ObjectMeta `json:"metadata,omitempty"`
59+
metav1.TypeMeta `json:",inline"`
60+
// +optional
61+
metav1.ObjectMeta `json:"metadata"`
6162

62-
Spec GoogleCASIssuerSpec `json:"spec,omitempty"`
63-
Status v1alpha1.IssuerStatus `json:"status,omitempty"`
63+
Spec GoogleCASIssuerSpec `json:"spec"`
64+
// +optional
65+
Status v1alpha1.IssuerStatus `json:"status,omitzero"`
6466
}
6567

6668
func (vi *GoogleCASIssuer) GetConditions() []metav1.Condition {
@@ -77,7 +79,8 @@ var _ v1alpha1.Issuer = &GoogleCASIssuer{}
7779
// GoogleCASIssuerList contains a list of GoogleCASIssuer
7880
type GoogleCASIssuerList struct {
7981
metav1.TypeMeta `json:",inline"`
80-
metav1.ListMeta `json:"metadata,omitempty"`
82+
// +optional
83+
metav1.ListMeta `json:"metadata"`
8184
Items []GoogleCASIssuer `json:"items"`
8285
}
8386

deploy/charts/google-cas-issuer/templates/crd-cas-issuer.jetstack.io_googlecasclusterissuers.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ spec:
155155
- type
156156
x-kubernetes-list-type: map
157157
type: object
158+
required:
159+
- spec
158160
type: object
159161
served: true
160162
storage: true

deploy/charts/google-cas-issuer/templates/crd-cas-issuer.jetstack.io_googlecasissuers.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ spec:
155155
- type
156156
x-kubernetes-list-type: map
157157
type: object
158+
required:
159+
- spec
158160
type: object
159161
served: true
160162
storage: true

deploy/crds/cas-issuer.jetstack.io_googlecasclusterissuers.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ spec:
155155
- type
156156
x-kubernetes-list-type: map
157157
type: object
158+
required:
159+
- spec
158160
type: object
159161
served: true
160162
storage: true

deploy/crds/cas-issuer.jetstack.io_googlecasissuers.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ spec:
154154
- type
155155
x-kubernetes-list-type: map
156156
type: object
157+
required:
158+
- spec
157159
type: object
158160
served: true
159161
storage: true

0 commit comments

Comments
 (0)