mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-11-06 05:17:08 +00:00
validation-gen: better check explicit opt-in/out
Rather than ONLY checking the SecondClosest comments, we can check the type's real comments, too.
This commit is contained in:
1 file changed
+6
@@ -334,10 +334,16 @@ func GetTargets(context *generator.Context, args *Args) []generator.Target {
|
||||
}
|
||||
shouldCreateObjectValidationFn := func(t *types.Type) bool {
|
||||
// opt-out
|
||||
if checkMainTag(t.CommentLines, "false") {
|
||||
return false
|
||||
}
|
||||
if checkMainTag(t.SecondClosestCommentLines, "false") {
|
||||
return false
|
||||
}
|
||||
// opt-in
|
||||
if checkMainTag(t.CommentLines, "true") {
|
||||
return true
|
||||
}
|
||||
if checkMainTag(t.SecondClosestCommentLines, "true") {
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user