2019-04-26 23:12:47 +08:00
|
|
|
package host
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Warnings struct {
|
2019-08-08 04:34:36 +08:00
|
|
|
List []error
|
2019-04-26 23:12:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (w *Warnings) Add(err error) {
|
|
|
|
w.List = append(w.List, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (w *Warnings) Reference() error {
|
|
|
|
if len(w.List) > 0 {
|
|
|
|
return w
|
|
|
|
} else {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (w *Warnings) Error() string {
|
2019-08-08 04:34:36 +08:00
|
|
|
return fmt.Sprintf("Number of warnings: %v", len(w.List))
|
2019-04-26 23:12:47 +08:00
|
|
|
}
|