Skip to content

Commit b5a56e5

Browse files
Remove redundant loops
Signed-off-by: Dan Jones <[email protected]>
1 parent b6f8ac2 commit b5a56e5

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

pkg/supportbundle/supportbundle.go

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -230,20 +230,10 @@ func AnalyzeSupportBundle(spec *troubleshootv1beta2.SupportBundleSpec, tmpDir st
230230
// the intention with these appends is to swap them out at a later date with more specific handlers for merging the spec fields
231231
func ConcatSpec(target *troubleshootv1beta2.SupportBundle, source *troubleshootv1beta2.SupportBundle) *troubleshootv1beta2.SupportBundle {
232232
newBundle := target.DeepCopy()
233-
for _, v := range source.Spec.Collectors {
234-
newBundle.Spec.Collectors = append(target.Spec.Collectors, v)
235-
}
236-
for _, v := range source.Spec.AfterCollection {
237-
newBundle.Spec.AfterCollection = append(target.Spec.AfterCollection, v)
238-
}
239-
for _, v := range source.Spec.HostCollectors {
240-
newBundle.Spec.HostCollectors = append(target.Spec.HostCollectors, v)
241-
}
242-
for _, v := range source.Spec.HostAnalyzers {
243-
newBundle.Spec.HostAnalyzers = append(target.Spec.HostAnalyzers, v)
244-
}
245-
for _, v := range source.Spec.Analyzers {
246-
newBundle.Spec.Analyzers = append(target.Spec.Analyzers, v)
247-
}
233+
newBundle.Spec.Collectors = append(target.Spec.Collectors, source.Spec.Collectors...)
234+
newBundle.Spec.AfterCollection = append(target.Spec.AfterCollection, source.Spec.AfterCollection...)
235+
newBundle.Spec.HostCollectors = append(target.Spec.HostCollectors, source.Spec.HostCollectors...)
236+
newBundle.Spec.HostAnalyzers = append(target.Spec.HostAnalyzers, source.Spec.HostAnalyzers...)
237+
newBundle.Spec.Analyzers = append(target.Spec.Analyzers, source.Spec.Analyzers...)
248238
return newBundle
249239
}

0 commit comments

Comments
 (0)