mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-17 11:28:58 +00:00
Forbid usage of omitzero for fields marked optional
This commit is contained in:
@@ -424,14 +424,14 @@ linters:
|
||||
# jsonTagRegex: "^[a-z][a-z0-9]*(?:[A-Z][a-z0-9]*)*$" # The default regex is appropriate for our use case.
|
||||
# nomaps:
|
||||
# policy: AllowStringToStringMaps # Determines how the linter should handle maps of basic types. Maps of objects are always disallowed.
|
||||
# optionalFields:
|
||||
# pointers:
|
||||
# preference: Always | WhenRequired # Whether to always require pointers, or only when required. Defaults to `Always`.
|
||||
# policy: SuggestFix | Warn # The policy for pointers in optional fields. Defaults to `SuggestFix`.
|
||||
# omitempty:
|
||||
# policy: SuggestFix | Warn | Ignore # The policy for omitempty in optional fields. Defaults to `SuggestFix`.
|
||||
# omitzero:
|
||||
# policy: SuggestFix | Warn | Forbid # The policy for omitzero in optional fields. Defaults to `SuggestFix`.
|
||||
optionalFields:
|
||||
pointers:
|
||||
preference: Always # Whether to always require pointers, or only when required. Defaults to `Always`.
|
||||
policy: SuggestFix # The policy for pointers in optional fields. Defaults to `SuggestFix`.
|
||||
omitempty:
|
||||
policy: SuggestFix # The policy for omitempty in optional fields. Defaults to `SuggestFix`.
|
||||
omitzero:
|
||||
policy: Forbid # The policy for omitzero in optional fields. Defaults to `SuggestFix`.
|
||||
# optionalOrRequired:
|
||||
# preferredOptionalMarker: optional # The preferred optional marker to use, fixes will suggest to use this marker. Defaults to `optional`.
|
||||
# preferredRequiredMarker: required # The preferred required marker to use, fixes will suggest to use this marker. Defaults to `required`.
|
||||
|
||||
@@ -437,14 +437,14 @@ linters:
|
||||
# jsonTagRegex: "^[a-z][a-z0-9]*(?:[A-Z][a-z0-9]*)*$" # The default regex is appropriate for our use case.
|
||||
# nomaps:
|
||||
# policy: AllowStringToStringMaps # Determines how the linter should handle maps of basic types. Maps of objects are always disallowed.
|
||||
# optionalFields:
|
||||
# pointers:
|
||||
# preference: Always | WhenRequired # Whether to always require pointers, or only when required. Defaults to `Always`.
|
||||
# policy: SuggestFix | Warn # The policy for pointers in optional fields. Defaults to `SuggestFix`.
|
||||
# omitempty:
|
||||
# policy: SuggestFix | Warn | Ignore # The policy for omitempty in optional fields. Defaults to `SuggestFix`.
|
||||
# omitzero:
|
||||
# policy: SuggestFix | Warn | Forbid # The policy for omitzero in optional fields. Defaults to `SuggestFix`.
|
||||
optionalFields:
|
||||
pointers:
|
||||
preference: Always # Whether to always require pointers, or only when required. Defaults to `Always`.
|
||||
policy: SuggestFix # The policy for pointers in optional fields. Defaults to `SuggestFix`.
|
||||
omitempty:
|
||||
policy: SuggestFix # The policy for omitempty in optional fields. Defaults to `SuggestFix`.
|
||||
omitzero:
|
||||
policy: Forbid # The policy for omitzero in optional fields. Defaults to `SuggestFix`.
|
||||
# optionalOrRequired:
|
||||
# preferredOptionalMarker: optional # The preferred optional marker to use, fixes will suggest to use this marker. Defaults to `optional`.
|
||||
# preferredRequiredMarker: required # The preferred required marker to use, fixes will suggest to use this marker. Defaults to `required`.
|
||||
|
||||
@@ -51,14 +51,14 @@ lintersConfig:
|
||||
# jsonTagRegex: "^[a-z][a-z0-9]*(?:[A-Z][a-z0-9]*)*$" # The default regex is appropriate for our use case.
|
||||
# nomaps:
|
||||
# policy: AllowStringToStringMaps # Determines how the linter should handle maps of basic types. Maps of objects are always disallowed.
|
||||
# optionalFields:
|
||||
# pointers:
|
||||
# preference: Always | WhenRequired # Whether to always require pointers, or only when required. Defaults to `Always`.
|
||||
# policy: SuggestFix | Warn # The policy for pointers in optional fields. Defaults to `SuggestFix`.
|
||||
# omitempty:
|
||||
# policy: SuggestFix | Warn | Ignore # The policy for omitempty in optional fields. Defaults to `SuggestFix`.
|
||||
# omitzero:
|
||||
# policy: SuggestFix | Warn | Forbid # The policy for omitzero in optional fields. Defaults to `SuggestFix`.
|
||||
optionalFields:
|
||||
pointers:
|
||||
preference: Always # Whether to always require pointers, or only when required. Defaults to `Always`.
|
||||
policy: SuggestFix # The policy for pointers in optional fields. Defaults to `SuggestFix`.
|
||||
omitempty:
|
||||
policy: SuggestFix # The policy for omitempty in optional fields. Defaults to `SuggestFix`.
|
||||
omitzero:
|
||||
policy: Forbid # The policy for omitzero in optional fields. Defaults to `SuggestFix`.
|
||||
# optionalOrRequired:
|
||||
# preferredOptionalMarker: optional # The preferred optional marker to use, fixes will suggest to use this marker. Defaults to `optional`.
|
||||
# preferredRequiredMarker: required # The preferred required marker to use, fixes will suggest to use this marker. Defaults to `required`.
|
||||
|
||||
Reference in New Issue
Block a user