osbuild: add variadic version of Pipeline.AddStage() method

This will allow to conveniently add multiple stages to the pipeline at
once, which is useful if a generator function wrapping some
functionality generates more than one `Stage`.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
Tomáš Hozza 2023-02-01 12:38:56 +01:00 committed by Sanne Raymaekers
parent b36c03f20c
commit acfceb74b2

View file

@ -36,3 +36,12 @@ func (p *Pipeline) AddStage(stage *Stage) {
p.Stages = append(p.Stages, stage)
}
}
// AddStages appends multiple stages to the list of stages of a pipeline. The
// stages will be executed in the order they are appended.
// If the argument is nil, it is not added.
func (p *Pipeline) AddStages(stages ...*Stage) {
for _, stage := range stages {
p.AddStage(stage)
}
}