1 package host 2 3 import ( 4 "fmt" 5 ) 6 7 type Warnings struct { 8 List []error 9 } 10 11 func (w *Warnings) Add(err error) { 12 w.List = append(w.List, err) 13 } 14 15 func (w *Warnings) Reference() error { 16 if len(w.List) > 0 { 17 return w 18 } else { 19 return nil 20 } 21 } 22 23 func (w *Warnings) Error() string { 24 return fmt.Sprintf("Number of warnings: %v", len(w.List)) 25 } 26