9 // A Booter ensures some piece of the system ("target") is correctly
10 // installed, configured, running, or working.
11 type Booter interface {
12 // Inspect, repair, and report the current state of the target.
13 Boot(context.Context) error
16 var cfgKey = &struct{}{}
18 func cfg(ctx context.Context) *Config {
19 return ctx.Value(cfgKey).(*Config)
22 func withCfg(ctx context.Context, cfg *Config) context.Context {
23 return context.WithValue(ctx, cfgKey, cfg)
28 func (sb Series) Boot(ctx context.Context) error {
29 for _, b := range sb {
38 type Concurrent []Booter
40 func (cb Concurrent) Boot(ctx context.Context) error {
41 errs := make([]error, len(cb))
44 for i, b := range cb {
52 return NewMultipleError(errs)
55 type MultipleError struct {
60 func NewMultipleError(errs []error) error {
62 for _, err := range errs {
63 switch err := err.(type) {
65 errors = append(errors, err.errors...)
68 errors = append(errors, err)
77 return &MultipleError{
78 error: fmt.Errorf("%d errors", len(errors)),