forked from kubernetes-sigs/kube-api-linter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patha.go
More file actions
108 lines (80 loc) · 5.26 KB
/
Copy patha.go
File metadata and controls
108 lines (80 loc) · 5.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
package a
type OptionalOrRequiredTestStruct struct {
NoMarkers string // want "field OptionalOrRequiredTestStruct.NoMarkers must be marked as optional or required"
// noOptionalOrRequiredMarker is a field with no optional or required marker.
// +enum
// +kubebuilder:validation:Enum=Foo;Bar
NoOptionalOrRequiredMarker string // want "field OptionalOrRequiredTestStruct.NoOptionalOrRequiredMarker must be marked as optional or required"
// +optional
// +required
MarkedOpitonalAndRequired string // want "field OptionalOrRequiredTestStruct.MarkedOpitonalAndRequired must not be marked as both optional and required"
// +optional
// +kubebuilder:validation:Optional
MarkedOptionalAndKubeBuilderOptional string // want "field OptionalOrRequiredTestStruct.MarkedOptionalAndKubeBuilderOptional should use only the marker optional, kubebuilder:validation:Optional is not required"
// +required
// +kubebuilder:validation:Required
MarkedRequiredAndKubeBuilderRequired string // want "field OptionalOrRequiredTestStruct.MarkedRequiredAndKubeBuilderRequired should use only the marker required, kubebuilder:validation:Required is not required"
// +kubebuilder:validation:Optional
KubebuilderOptionalMarker string // want "field OptionalOrRequiredTestStruct.KubebuilderOptionalMarker should use marker optional instead of kubebuilder:validation:Optional"
// +kubebuilder:validation:Required
KubebuilderRequiredMarker string // want "field OptionalOrRequiredTestStruct.KubebuilderRequiredMarker should use marker required instead of kubebuilder:validation:Required"
// +optional
OptionalMarker string
// +required
RequiredMarker string
// +kubebuilder:validation:Optional
// +kubebuilder:validation:Optional
MarkedWithKubeBuilderOptionalTwice string // want "field OptionalOrRequiredTestStruct.MarkedWithKubeBuilderOptionalTwice should use marker optional instead of kubebuilder:validation:Optional"
// +kubebuilder:validation:Optional
// +kubebuilder:validation:Optional
// +optional
MarkedWithKubeBuilderOptionalTwiceAndOptional string // want "field OptionalOrRequiredTestStruct.MarkedWithKubeBuilderOptionalTwiceAndOptional should use only the marker optional, kubebuilder:validation:Optional is not required"
// MarkedWithK8sRequiredAndKubeBuilderRequired is a field with both k8s and kubebuilder required markers.
// The k8s versions of the markers are currently in addition to other markers so this is accepted.
// +k8s:required
// +kubebuilder:validation:Required
MarkedWithK8sRequiredAndKubeBuilderRequired string // want "field OptionalOrRequiredTestStruct.MarkedWithK8sRequiredAndKubeBuilderRequired should use marker required instead of kubebuilder:validation:Required"
// MarkedWithK8sRequiredAndRequired is a field with both k8s and required markers.
// The k8s versions of the markers are currently in addition to other markers so this is accepted.
// +k8s:required
// +required
MarkedWithK8sRequiredAndRequired string
// MarkedWithK8sOptionalAndKubeBuilderOptional is a field with both k8s and kubebuilder optional markers.
// The k8s versions of the markers are currently in addition to other markers so this is accepted.
// +k8s:optional
// +kubebuilder:validation:Optional
MarkedWithK8sOptionalAndKubeBuilderOptional string // want "field OptionalOrRequiredTestStruct.MarkedWithK8sOptionalAndKubeBuilderOptional should use marker optional instead of kubebuilder:validation:Optional"
// MarkedWithK8sOptionalAndOptional is a field with both k8s and optional markers.
// The k8s versions of the markers are currently in addition to other markers so this is accepted.
// +k8s:optional
// +optional
MarkedWithK8sOptionalAndOptional string
// MarkedWithK8sOptionalAndRequired is a field with both k8s and required markers.
// The k8s versions of the markers are currently in addition to other markers, but they should match the semantics.
// +k8s:optional
// +required
MarkedWithK8sOptionalAndRequired string // want "field OptionalOrRequiredTestStruct.MarkedWithK8sOptionalAndRequired must not be marked as both k8s:optional and required"
// MarkedWithK8sRequiredAndOptional is a field with both k8s and optional markers.
// The k8s versions of the markers are currently in addition to other markers, but they should match the semantics.
// +k8s:required
// +optional
MarkedWithK8sRequiredAndOptional string // want "field OptionalOrRequiredTestStruct.MarkedWithK8sRequiredAndOptional must not be marked as both optional and k8s:required"
// MarkedWithK8sRequiredAndK8sOptional is a field with both k8s and kubebuilder optional markers.
// +k8s:required
// +k8s:optional
MarkedWithK8sRequiredAndK8sOptional string // want "field OptionalOrRequiredTestStruct.MarkedWithK8sRequiredAndK8sOptional must be marked as optional or required" "field OptionalOrRequiredTestStruct.MarkedWithK8sRequiredAndK8sOptional must not be marked as both k8s:optional and k8s:required"
A `json:",inline"`
B `json:"b,omitempty"` // want "embedded field OptionalOrRequiredTestStruct.B must be marked as optional or required"
// +optional
C `json:"c,omitempty"`
Embedded `json:""`
}
type A struct{}
// DoNothing is used to check that the analyser doesn't report on methods.
func (A) DoNothing() {}
type B struct{}
type C struct{}
type Interface interface {
InaccessibleFunction() string
}
type Embedded struct{}