mirror of https://github.com/shirou/gopsutil
commit
d8686bcd5c
@ -0,0 +1,25 @@
|
||||
package host
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type Warnings struct {
|
||||
List []error
|
||||
}
|
||||
|
||||
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 {
|
||||
return fmt.Sprintf("Number of warnings: %v", len(w.List))
|
||||
}
|
Loading…
Reference in New Issue