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: pkg/analysis/optionalfields/testdata/src/a/a.go
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -23,23 +23,23 @@ type A struct {
23
23
24
24
// NonOmittedString is a string field without omitempty
25
25
// +optional
26
-
NonOmittedStringstring`json:"nonOmittedString"`// want "field NonOmittedString is optional and should be a pointer" "field NonOmittedString is optional and should be omitempty"
26
+
NonOmittedStringstring`json:"nonOmittedString"`// want "field NonOmittedString is optional and should be a pointer" "field NonOmittedString is optional and should have the omitempty tag"
27
27
28
28
// int is an int field.
29
29
// +optional
30
30
Intint`json:"int,omitempty"`// want "field Int is optional and should be a pointer"
31
31
32
32
// nonOmittedInt is an int field without omitempty
33
33
// +optional
34
-
NonOmittedIntint`json:"nonOmittedInt"`// want "field NonOmittedInt is optional and should be a pointer" "field NonOmittedInt is optional and should be omitempty"
34
+
NonOmittedIntint`json:"nonOmittedInt"`// want "field NonOmittedInt is optional and should be a pointer" "field NonOmittedInt is optional and should have the omitempty tag"
35
35
36
36
// struct is a struct field.
37
37
// +optional
38
38
StructB`json:"struct,omitempty"`// want "field Struct is optional and should be a pointer"
39
39
40
40
// nonOmittedStruct is a struct field without omitempty.
41
41
// +optional
42
-
NonOmittedStructB`json:"nonOmittedStruct"`// want "field NonOmittedStruct is optional and should be a pointer" "field NonOmittedStruct is optional and should be omitempty"
42
+
NonOmittedStructB`json:"nonOmittedStruct"`// want "field NonOmittedStruct is optional and should be a pointer" "field NonOmittedStruct is optional and should have the omitempty tag"
43
43
44
44
// structWithMinProperties is a struct field with a minimum number of properties.
45
45
// +kubebuilder:validation:MinProperties=1
@@ -60,15 +60,15 @@ type A struct {
60
60
61
61
// PointerSlice is a pointer slice field.
62
62
// +optional
63
-
PointerSlice*[]string`json:"pointerSlice,omitempty"`// want "field PointerSlice is a pointer type and should not be a pointer"
63
+
PointerSlice*[]string`json:"pointerSlice,omitempty"`// want "field PointerSlice is optional but the underlying type does not need to be a pointer. The pointer should be removed."
64
64
65
65
// PointerMap is a pointer map field.
66
66
// +optional
67
-
PointerMap*map[string]string`json:"pointerMap,omitempty"`// want "field PointerMap is a pointer type and should not be a pointer"
67
+
PointerMap*map[string]string`json:"pointerMap,omitempty"`// want "field PointerMap is optional but the underlying type does not need to be a pointer. The pointer should be removed."
68
68
69
69
// PointerPointerString is a double pointer string field.
70
70
// +optional
71
-
DoublePointerString**string`json:"doublePointerString,omitempty"`// want "field DoublePointerString is a pointer type and should not be a pointer"
71
+
DoublePointerString**string`json:"doublePointerString,omitempty"`// want "field DoublePointerString is optional but the underlying type does not need to be a pointer. The pointer should be removed."
72
72
73
73
// PointerStringAlias is a pointer string alias field.
74
74
// +optional
@@ -93,11 +93,11 @@ type A struct {
93
93
94
94
// PointerSliceAlias is a pointer slice alias field.
PointerSliceAlias*SliceAlias`json:"pointerSliceAlias,omitempty"`// want "field PointerSliceAlias is optional but the underlying type does not need to be a pointer. The pointer should be removed."
PointerMapAlias*MapAlias`json:"pointerMapAlias,omitempty"`// want "field PointerMapAlias is optional but the underlying type does not need to be a pointer. The pointer should be removed."
Copy file name to clipboardExpand all lines: pkg/analysis/optionalfields/testdata/src/a/a.go.golden
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -23,23 +23,23 @@ type A struct {
23
23
24
24
// NonOmittedString is a string field without omitempty
25
25
// +optional
26
-
NonOmittedString *string `json:"nonOmittedString,omitempty"` // want "field NonOmittedString is optional and should be a pointer" "field NonOmittedString is optional and should be omitempty"
26
+
NonOmittedString *string `json:"nonOmittedString,omitempty"` // want "field NonOmittedString is optional and should be a pointer" "field NonOmittedString is optional and should have the omitempty tag"
27
27
28
28
// int is an int field.
29
29
// +optional
30
30
Int *int `json:"int,omitempty"` // want "field Int is optional and should be a pointer"
31
31
32
32
// nonOmittedInt is an int field without omitempty
33
33
// +optional
34
-
NonOmittedInt *int `json:"nonOmittedInt,omitempty"` // want "field NonOmittedInt is optional and should be a pointer" "field NonOmittedInt is optional and should be omitempty"
34
+
NonOmittedInt *int `json:"nonOmittedInt,omitempty"` // want "field NonOmittedInt is optional and should be a pointer" "field NonOmittedInt is optional and should have the omitempty tag"
35
35
36
36
// struct is a struct field.
37
37
// +optional
38
38
Struct *B `json:"struct,omitempty"` // want "field Struct is optional and should be a pointer"
39
39
40
40
// nonOmittedStruct is a struct field without omitempty.
41
41
// +optional
42
-
NonOmittedStruct *B `json:"nonOmittedStruct,omitempty"` // want "field NonOmittedStruct is optional and should be a pointer" "field NonOmittedStruct is optional and should be omitempty"
42
+
NonOmittedStruct *B `json:"nonOmittedStruct,omitempty"` // want "field NonOmittedStruct is optional and should be a pointer" "field NonOmittedStruct is optional and should have the omitempty tag"
43
43
44
44
// structWithMinProperties is a struct field with a minimum number of properties.
45
45
// +kubebuilder:validation:MinProperties=1
@@ -60,15 +60,15 @@ type A struct {
60
60
61
61
// PointerSlice is a pointer slice field.
62
62
// +optional
63
-
PointerSlice []string `json:"pointerSlice,omitempty"` // want "field PointerSlice is a pointer type and should not be a pointer"
63
+
PointerSlice []string `json:"pointerSlice,omitempty"` // want "field PointerSlice is optional but the underlying type does not need to be a pointer. The pointer should be removed."
64
64
65
65
// PointerMap is a pointer map field.
66
66
// +optional
67
-
PointerMap map[string]string `json:"pointerMap,omitempty"` // want "field PointerMap is a pointer type and should not be a pointer"
67
+
PointerMap map[string]string `json:"pointerMap,omitempty"` // want "field PointerMap is optional but the underlying type does not need to be a pointer. The pointer should be removed."
68
68
69
69
// PointerPointerString is a double pointer string field.
70
70
// +optional
71
-
DoublePointerString *string `json:"doublePointerString,omitempty"` // want "field DoublePointerString is a pointer type and should not be a pointer"
71
+
DoublePointerString *string `json:"doublePointerString,omitempty"` // want "field DoublePointerString is optional but the underlying type does not need to be a pointer. The pointer should be removed."
72
72
73
73
// PointerStringAlias is a pointer string alias field.
74
74
// +optional
@@ -93,11 +93,11 @@ type A struct {
93
93
94
94
// PointerSliceAlias is a pointer slice alias field.
PointerSliceAlias SliceAlias `json:"pointerSliceAlias,omitempty"` // want "field PointerSliceAlias is optional but the underlying type does not need to be a pointer. The pointer should be removed."
PointerMapAlias MapAlias `json:"pointerMapAlias,omitempty"` // want "field PointerMapAlias is optional but the underlying type does not need to be a pointer. The pointer should be removed."
0 commit comments