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 /pkg/adapter/runtime.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 'pkg/adapter/runtime.go')
-rw-r--r-- | pkg/adapter/runtime.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/pkg/adapter/runtime.go b/pkg/adapter/runtime.go index 5f880e807..3be65a03e 100644 --- a/pkg/adapter/runtime.go +++ b/pkg/adapter/runtime.go @@ -407,7 +407,8 @@ func (r *LocalRuntime) Events(c *cliconfig.EventValues) error { } w := bufio.NewWriter(os.Stdout) for event := range eventChannel { - if c.Format == formats.JSONString { + switch { + case c.Format == formats.JSONString: jsonStr, err := event.ToJSONString() if err != nil { return errors.Wrapf(err, "unable to format json") @@ -415,11 +416,11 @@ func (r *LocalRuntime) Events(c *cliconfig.EventValues) error { if _, err := w.Write([]byte(jsonStr)); err != nil { return err } - } else if len(c.Format) > 0 { + case len(c.Format) > 0: if err := tmpl.Execute(w, event); err != nil { return err } - } else { + default: if _, err := w.Write([]byte(event.ToHumanReadable())); err != nil { return err } |