diff options
author | Valentin Rothberg <rothberg@redhat.com> | 2020-01-13 13:01:45 +0100 |
---|---|---|
committer | Valentin Rothberg <rothberg@redhat.com> | 2020-01-13 14:27:02 +0100 |
commit | 67165b76753f65b6f58d471f314678ae12a4c722 (patch) | |
tree | 72580ee08e5d9d2e57b97a7293deaf8a2a0f2e67 /cmd/podman/stats.go | |
parent | 270d892c3d77de4fd8e6341193175c0572fb5f99 (diff) | |
download | podman-67165b76753f65b6f58d471f314678ae12a4c722.tar.gz podman-67165b76753f65b6f58d471f314678ae12a4c722.tar.bz2 podman-67165b76753f65b6f58d471f314678ae12a4c722.zip |
make lint: enable gocritic
`gocritic` is a powerful linter that helps in preventing certain kinds
of errors as well as enforcing a coding style.
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'cmd/podman/stats.go')
-rw-r--r-- | cmd/podman/stats.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/cmd/podman/stats.go b/cmd/podman/stats.go index f53e09412..08fddc47a 100644 --- a/cmd/podman/stats.go +++ b/cmd/podman/stats.go @@ -105,9 +105,10 @@ func statsCmd(c *cliconfig.StatsValues) error { var ctrs []*libpod.Container containerFunc := runtime.GetRunningContainers - if len(c.InputArgs) > 0 { + switch { + case len(c.InputArgs) > 0: containerFunc = func() ([]*libpod.Container, error) { return runtime.GetContainersByList(c.InputArgs) } - } else if latest { + case latest: containerFunc = func() ([]*libpod.Container, error) { lastCtr, err := runtime.GetLatestContainer() if err != nil { @@ -115,7 +116,7 @@ func statsCmd(c *cliconfig.StatsValues) error { } return []*libpod.Container{lastCtr}, nil } - } else if all { + case all: containerFunc = runtime.GetAllContainers } @@ -219,14 +220,14 @@ func genStatsFormat(format string) string { } // imagesToGeneric creates an empty array of interfaces for output -func statsToGeneric(templParams []statsOutputParams, JSONParams []statsOutputParams) (genericParams []interface{}) { +func statsToGeneric(templParams []statsOutputParams, jsonParams []statsOutputParams) (genericParams []interface{}) { if len(templParams) > 0 { for _, v := range templParams { genericParams = append(genericParams, interface{}(v)) } return } - for _, v := range JSONParams { + for _, v := range jsonParams { genericParams = append(genericParams, interface{}(v)) } return |