You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// structWithOnlyOmitZeroTag is a struct field with a minimum number of properties and has only omitzero tag.
180
+
// +kubebuilder:validation:MinProperties=1
181
+
// +optional
182
+
StructWithOnlyOmitZeroTagB`json:"structWithOnlyOmitZeroTag,omitzero"`// want "field StructWithOnlyOmitZeroTag is optional and should have the omitempty tag"
178
183
179
184
// structWithMinPropertiesOnStruct is a struct field with a minimum number of properties on the struct.
Copy file name to clipboardExpand all lines: pkg/analysis/optionalfields/testdata/src/b/a.go.golden
+7-2Lines changed: 7 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -171,10 +171,15 @@ type A struct {
171
171
// +optional
172
172
StructWithMinProperties *B `json:"structWithMinProperties,omitempty"` // want "field StructWithMinProperties is optional and should be a pointer"
173
173
174
-
// StructWithMinPropertiesAndOmitEmptyTag is a struct field with a minimum number of properties.
174
+
// structWithMinPropertiesAndOmitEmptyAndOmitZero is a struct field with a minimum number of properties and has both omitzero and omitemtpy tag.
175
175
// +kubebuilder:validation:MinProperties=1
176
176
// +optional
177
-
StructWithMinPropertiesAndOmitEmptyTag B `json:"structWithMinPropertiesAndOmitEmptyTag,omitempty,omitzero"`
177
+
StructWithMinPropertiesAndOmitEmptyAndOmitZero B `json:"structWithMinPropertiesAndOmitEmptyAndOmitZero,omitempty,omitzero"`
178
+
179
+
// structWithOnlyOmitZeroTag is a struct field with a minimum number of properties and has only omitzero tag.
180
+
// +kubebuilder:validation:MinProperties=1
181
+
// +optional
182
+
StructWithOnlyOmitZeroTag B `json:"structWithOnlyOmitZeroTag,omitempty,omitzero"` // want "field StructWithOnlyOmitZeroTag is optional and should have the omitempty tag"
178
183
179
184
// structWithMinPropertiesOnStruct is a struct field with a minimum number of properties on the struct.
0 commit comments