mirror of
https://github.com/containers/podman.git
synced 2025-05-21 17:16:22 +08:00
Update module github.com/shirou/gopsutil to v4
Signed-off-by: Mikel Olasagasti Uranga <mikel@olasagasti.info>
This commit is contained in:
31
vendor/github.com/shirou/gopsutil/v4/internal/common/warnings.go
generated
vendored
Normal file
31
vendor/github.com/shirou/gopsutil/v4/internal/common/warnings.go
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
package common
|
||||
|
||||
import "fmt"
|
||||
|
||||
type Warnings struct {
|
||||
List []error
|
||||
Verbose bool
|
||||
}
|
||||
|
||||
func (w *Warnings) Add(err error) {
|
||||
w.List = append(w.List, err)
|
||||
}
|
||||
|
||||
func (w *Warnings) Reference() error {
|
||||
if len(w.List) > 0 {
|
||||
return w
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (w *Warnings) Error() string {
|
||||
if w.Verbose {
|
||||
str := ""
|
||||
for i, e := range w.List {
|
||||
str += fmt.Sprintf("\tError %d: %s\n", i, e.Error())
|
||||
}
|
||||
return str
|
||||
}
|
||||
return fmt.Sprintf("Number of warnings: %v", len(w.List))
|
||||
}
|
Reference in New Issue
Block a user