@@ -29,7 +29,7 @@ import (
29
29
// IsAPIResource returns true if t has a +resource/+kubebuilder:resource comment tag
30
30
func IsAPIResource (t * types.Type ) bool {
31
31
for _ , c := range t .CommentLines {
32
- if strings .Contains (c , "+resource" ) || strings .Contains (c , "+kubebuilder:resource" ){
32
+ if strings .Contains (c , "+resource" ) || strings .Contains (c , "+kubebuilder:resource" ) {
33
33
return true
34
34
}
35
35
}
@@ -57,6 +57,7 @@ func IsNonNamespaced(t *types.Type) bool {
57
57
return false
58
58
}
59
59
60
+ // IsController returns true if t has a +controller or +kubebuilder:controller tag
60
61
func IsController (t * types.Type ) bool {
61
62
for _ , c := range t .CommentLines {
62
63
if strings .Contains (c , "+controller" ) || strings .Contains (c , "+kubebuilder:controller" ) {
@@ -66,6 +67,7 @@ func IsController(t *types.Type) bool {
66
67
return false
67
68
}
68
69
70
+ // IsRBAC returns true if t has a +rbac or +kubebuilder:rbac tag
69
71
func IsRBAC (t * types.Type ) bool {
70
72
for _ , c := range t .CommentLines {
71
73
if strings .Contains (c , "+rbac" ) || strings .Contains (c , "+kubebuilder:rbac" ) {
@@ -75,16 +77,16 @@ func IsRBAC(t *types.Type) bool {
75
77
return false
76
78
}
77
79
80
+ // IsInformer returns true if t has a +informers or +kubebuilder:informers tag
78
81
func IsInformer (t * types.Type ) bool {
79
- for _ , c := range t .CommentLines {
80
- if strings .Contains (c , "+informers" ) || strings .Contains (c , "+kubebuilder:informers" ) {
81
- return true
82
- }
83
- }
84
- return false
82
+ for _ , c := range t .CommentLines {
83
+ if strings .Contains (c , "+informers" ) || strings .Contains (c , "+kubebuilder:informers" ) {
84
+ return true
85
+ }
86
+ }
87
+ return false
85
88
}
86
89
87
-
88
90
// IsAPISubresource returns true if t has a +subresource-request comment tag
89
91
func IsAPISubresource (t * types.Type ) bool {
90
92
for _ , c := range t .CommentLines {
@@ -162,6 +164,7 @@ func (c Comments) getTag(name, sep string) string {
162
164
return ""
163
165
}
164
166
167
+ // hasTag returns true if the Comments has a tag with the given name
165
168
func (c Comments ) hasTag (name string ) bool {
166
169
for _ , c := range c {
167
170
prefix := fmt .Sprintf ("+%s" , name )
0 commit comments