Skip to content

Commit

Permalink
IWF-124: Add filtering for NewOutputCollector
Browse files Browse the repository at this point in the history
  • Loading branch information
lwolczynski committed Dec 18, 2024
1 parent f2825b4 commit 4748f34
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions service/interpreter/outputCollector.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,22 @@ type OutputCollector struct {
}

func NewOutputCollector(initOutputs []iwfidl.StateCompletionOutput) *OutputCollector {
filteredOutputs := []iwfidl.StateCompletionOutput{}

if initOutputs == nil {
initOutputs = []iwfidl.StateCompletionOutput{}
}
return &OutputCollector{
outputs: initOutputs,
return &OutputCollector{
outputs: filteredOutputs,
}
} else {
for _, output := range initOutputs {
if output.CompletedStateOutput != nil {
filteredOutputs = append(filteredOutputs, output)
}
}

return &OutputCollector{
outputs: filteredOutputs,
}
}
}

Expand Down

0 comments on commit 4748f34

Please sign in to comment.