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
Copy file name to clipboardExpand all lines: .golangci-kal.yml
+8Lines changed: 8 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,8 @@ linters:
22
22
- "maxlength"# Ensure all strings and arrays have maximum lengths/maximum items.
23
23
- "nobools"# Bools do not evolve over time, should use enums instead.
24
24
- "nofloats"# Ensure floats are not used.
25
+
- "optionalfields"# Ensure that all fields marked as optional adhere to being pointers and
26
+
# having the `omitempty` value in their `json` tag where appropriate.
25
27
- "optionalorrequired"# Every field should be marked as `+optional` or `+required`.
26
28
- "requiredfields"# Required fields should not be pointers, and should not have `omitempty`.
27
29
- "statussubresource"# All root objects that have a `status` field should have a status subresource.
@@ -44,6 +46,12 @@ linters:
44
46
# optionalOrRequired:
45
47
# preferredOptionalMarker: optional | kubebuilder:validation:Optional # The preferred optional marker to use, fixes will suggest to use this marker. Defaults to `optional`.
46
48
# preferredRequiredMarker: required | kubebuilder:validation:Required # The preferred required marker to use, fixes will suggest to use this marker. Defaults to `required`.
49
+
optionalFields:
50
+
pointers:
51
+
preference: Always # Always | WhenRequired # Whether to always require pointers, or only when required. Defaults to `Always`.
52
+
policy: SuggestFix # SuggestFix | Warn # The policy for pointers in optional fields. Defaults to `SuggestFix`.
53
+
omitempty:
54
+
policy: SuggestFix # SuggestFix | Warn | Ignore # The policy for omitempty in optional fields. Defaults to `SuggestFix`.
47
55
# requiredFields:
48
56
# pointerPolicy: Warn | SuggestFix # Defaults to `SuggestFix`. We want our required fields to not be pointers.
0 commit comments