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
|
|
|
|
}
|
2021-12-23 06:49:50 +08:00
|
|
|
return nil
|
2019-04-26 23:12:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
}
|