@@ -111,13 +111,16 @@ func ApplyProjection(crd *apiextensionsv1.CustomResourceDefinition, pubRes *sync
111111func stripUnwantedVersions (crd * apiextensionsv1.CustomResourceDefinition , pubRes * syncagentv1alpha1.PublishedResource ) (* apiextensionsv1.CustomResourceDefinition , error ) {
112112 src := pubRes .Spec .Resource
113113
114+ //nolint:staticcheck
114115 if src .Version != "" && len (src .Versions ) > 0 {
115116 return nil , errors .New ("cannot configure both .version and .versions in as the source of a PublishedResource" )
116117 }
117118
118119 crd .Spec .Versions = slices .DeleteFunc (crd .Spec .Versions , func (ver apiextensionsv1.CustomResourceDefinitionVersion ) bool {
119120 switch {
121+ //nolint:staticcheck
120122 case src .Version != "" :
123+ //nolint:staticcheck
121124 return ver .Name != src .Version
122125 case len (src .Versions ) > 0 :
123126 return ! slices .Contains (src .Versions , ver .Name )
@@ -128,7 +131,9 @@ func stripUnwantedVersions(crd *apiextensionsv1.CustomResourceDefinition, pubRes
128131
129132 if len (crd .Spec .Versions ) == 0 {
130133 switch {
134+ //nolint:staticcheck
131135 case src .Version != "" :
136+ //nolint:staticcheck
132137 return nil , fmt .Errorf ("CRD does not contain version %s" , src .Version )
133138 case len (src .Versions ) > 0 :
134139 return nil , fmt .Errorf ("CRD does not contain any of versions %v" , src .Versions )
@@ -185,11 +190,13 @@ func projectCRD(crd *apiextensionsv1.CustomResourceDefinition, pubRes *syncagent
185190
186191 // We already validated that Version and Versions can be set at the same time.
187192
193+ //nolint:staticcheck
188194 if projection .Version != "" {
189195 if size := len (crd .Spec .Versions ); size != 1 {
190196 return nil , fmt .Errorf ("cannot project CRD version to a single version %q because it contains %d versions" , projection .Version , size )
191197 }
192198
199+ //nolint:staticcheck
193200 crd .Spec .Versions [0 ].Name = projection .Version
194201 } else if len (projection .Versions ) > 0 {
195202 for _ , mut := range projection .Versions {
0 commit comments