forked from mitchellh/golicense
-
Notifications
You must be signed in to change notification settings - Fork 0
/
output_multi.go
45 lines (38 loc) · 943 Bytes
/
output_multi.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package main
import (
"github.com/hashicorp/go-multierror"
"github.com/mitchellh/golicense/license"
"github.com/mitchellh/golicense/module"
)
// MultiOutput calls the functions of multiple Output implementations.
type MultiOutput struct {
Outputs []Output
}
// Start implements Output
func (o *MultiOutput) Start(m *module.Module) {
for _, out := range o.Outputs {
out.Start(m)
}
}
// Update implements Output
func (o *MultiOutput) Update(m *module.Module, t license.StatusType, msg string) {
for _, out := range o.Outputs {
out.Update(m, t, msg)
}
}
// Finish implements Output
func (o *MultiOutput) Finish(m *module.Module, l *license.License, err error) {
for _, out := range o.Outputs {
out.Finish(m, l, err)
}
}
// Close implements Output
func (o *MultiOutput) Close() error {
var err error
for _, out := range o.Outputs {
if e := out.Close(); e != nil {
err = multierror.Append(err, e)
}
}
return err
}