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