Skip to content

Commit d80cc3d

Browse files
committed
enable jsontags rule
Signed-off-by: sivchari <[email protected]>
1 parent e95ff05 commit d80cc3d

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

.golangci-kal.yml

+9-3
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ linters-settings:
1818
enable:
1919
- "conditions" # Ensure conditions have the correct json tags and markers.
2020
- "integers" # Ensure only int32 and int64 are used for integers.
21-
- "statussubresource" # All root objects that have a `status` field should have a status subresource.
22-
- "nofloats" # Ensure floats are not used.
21+
- "jsontags" # Ensure every field has a json tag.
2322
- "maxlength" # Ensure all strings and arrays have maximum lengths/maximum items.
2423
- "nobools" # Bools do not evolve over time, should use enums instead.
24+
- "nofloats" # Ensure floats are not used.
25+
- "requiredfields" # Required fields should not be pointers, and should not have `omitempty`.
26+
- "statussubresource" # All root objects that have a `status` field should have a status subresource.
2527

2628
# Per discussion in July 2024, we are keeping phase fields for now.
2729
# See https://github.com/kubernetes-sigs/cluster-api/pull/10897#discussion_r1685929508
@@ -30,7 +32,6 @@ linters-settings:
3032

3133
# Linters below this line are disabled, pending conversation on how and when to enable them.
3234
# - "commentstart" # Ensure comments start with the serialized version of the field name.
33-
# - "jsontags" # Ensure every field has a json tag.
3435
# - "optionalorrequired" # Every field should be marked as `+optional` or `+required`.
3536
# - "requiredfields" # Required fields should not be pointers, and should not have `omitempty`.
3637
disable:
@@ -82,3 +83,8 @@ issues:
8283
text: "nobools"
8384
linters:
8485
- kal
86+
# We follow the current CustomResourceDefinition field's json tag pattern.
87+
- path: "api/v1beta1/*"
88+
text: "field (XPreserveUnknownFields|XPreserveUnknownFields|XValidations|XMetadata|XIntOrString) json tag does not match pattern"
89+
linters:
90+
- kal

hack/tools/.custom-gcl.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ name: golangci-lint-kal-v1.63.4
33
destination: ./bin
44
plugins:
55
- module: 'github.com/JoelSpeed/kal'
6-
version: v0.0.0-20250208110507-b94e5ede1177
6+
version: v0.0.0-20250228165733-9fe9adef0dc7

0 commit comments

Comments
 (0)