mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-08-18 22:37:52 +00:00
The nolintlint linter does not deny the use of `//nolint` Instead it allows us to enforce a common nolint style: - force that a linter name must be specified - do not add a space between `//` and `nolint` - make sure nolint is only used when there is actually a problem Signed-off-by: Paul Holzinger <pholzing@redhat.com>
40 lines
719 B
Go
40 lines
719 B
Go
package reports
|
|
|
|
type PruneReport struct {
|
|
Id string `json:"Id"` //nolint:revive,stylecheck
|
|
Err error `json:"Err,omitempty"`
|
|
Size uint64 `json:"Size"`
|
|
}
|
|
|
|
func PruneReportsIds(r []*PruneReport) []string {
|
|
ids := make([]string, 0, len(r))
|
|
for _, v := range r {
|
|
if v == nil || v.Id == "" {
|
|
continue
|
|
}
|
|
ids = append(ids, v.Id)
|
|
}
|
|
return ids
|
|
}
|
|
|
|
func PruneReportsErrs(r []*PruneReport) []error {
|
|
errs := make([]error, 0, len(r))
|
|
for _, v := range r {
|
|
if v == nil || v.Err == nil {
|
|
continue
|
|
}
|
|
errs = append(errs, v.Err)
|
|
}
|
|
return errs
|
|
}
|
|
|
|
func PruneReportsSize(r []*PruneReport) uint64 {
|
|
size := uint64(0)
|
|
for _, v := range r {
|
|
if v == nil {
|
|
continue
|
|
}
|
|
size += v.Size
|
|
}
|
|
return size
|
|
}
|