@@ -58,46 +58,6 @@ func checkFields(csv *operatorsv1alpha1.ClusterServiceVersion) (errs []errors.Er
58
58
return append (result .Errors , result .Warnings ... )
59
59
}
60
60
61
- // Recursive function that traverses a nested struct passed in as reflect value, and reports for errors/warnings
62
- // in case of null struct field values.
63
- func checkMissingFields (result * errors.ManifestResult , v reflect.Value , parentStructName string ) {
64
- if v .Kind () != reflect .Struct {
65
- return
66
- }
67
- typ := v .Type ()
68
-
69
- for i := 0 ; i < v .NumField (); i ++ {
70
- fieldValue := v .Field (i )
71
- fieldType := typ .Field (i )
72
-
73
- tag := fieldType .Tag .Get ("json" )
74
- // Ignore fields that are subsets of a primitive field.
75
- if tag == "" {
76
- continue
77
- }
78
-
79
- // Omitted field tags will contain ",omitempty", and ignored tags will
80
- // match "-" exactly, respectively.
81
- isOptionalField := strings .Contains (tag , ",omitempty" ) || tag == "-"
82
- emptyVal := isEmptyValue (fieldValue )
83
-
84
- newParentStructName := fieldType .Name
85
- if parentStructName != "" {
86
- newParentStructName = parentStructName + "." + newParentStructName
87
- }
88
-
89
- switch fieldValue .Kind () {
90
- case reflect .Struct :
91
- updateLog (result , "struct" , newParentStructName , emptyVal , isOptionalField )
92
- if ! emptyVal {
93
- checkMissingFields (result , fieldValue , newParentStructName )
94
- }
95
- default :
96
- updateLog (result , "field" , newParentStructName , emptyVal , isOptionalField )
97
- }
98
- }
99
- }
100
-
101
61
// Returns updated error log with missing optional/mandatory field/struct objects.
102
62
func updateLog (result * errors.ManifestResult , typeName string , newParentStructName string , emptyVal bool , isOptionalField bool ) {
103
63
if ! emptyVal {
0 commit comments