diff options
author | Šimon Lukašík <slukasik@redhat.com> | 2018-11-10 10:26:57 +0100 |
---|---|---|
committer | Šimon Lukašík <slukasik@redhat.com> | 2018-11-10 10:52:24 +0100 |
commit | 7457815ba930fdabff6ee57f4b7ec29d9fbcfcf8 (patch) | |
tree | 0e8aed1299dfb0450f12d0eddc48c04af66c6de2 /libpod | |
parent | 4e755515300d450139d85354082efdedf6fb5357 (diff) | |
download | podman-7457815ba930fdabff6ee57f4b7ec29d9fbcfcf8.tar.gz podman-7457815ba930fdabff6ee57f4b7ec29d9fbcfcf8.tar.bz2 podman-7457815ba930fdabff6ee57f4b7ec29d9fbcfcf8.zip |
Lint: Extract constant unknownPackage
Addressing goconst warning: 3 other occurrence(s) of "Unknown" found
Signed-off-by: Šimon Lukašík <slukasik@redhat.com>
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/oci_linux.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libpod/oci_linux.go b/libpod/oci_linux.go index e6b7cbe4f..b159eae78 100644 --- a/libpod/oci_linux.go +++ b/libpod/oci_linux.go @@ -19,6 +19,8 @@ import ( "golang.org/x/sys/unix" ) +const unknownPackage = "Unknown" + func (r *OCIRuntime) moveConmonToCgroup(ctr *Container, cgroupParent string, cmd *exec.Cmd) error { if os.Geteuid() == 0 { if r.cgroupManager == SystemdCgroupsManager { @@ -112,7 +114,7 @@ func (r *OCIRuntime) createContainer(ctr *Container, cgroupParent string, restor } func rpmVersion(path string) string { - output := "Unknown" + output := unknownPackage cmd := exec.Command("/usr/bin/rpm", "-q", "-f", path) if outp, err := cmd.Output(); err == nil { output = string(outp) @@ -121,7 +123,7 @@ func rpmVersion(path string) string { } func dpkgVersion(path string) string { - output := "Unknown" + output := unknownPackage cmd := exec.Command("/usr/bin/dpkg", "-S", path) if outp, err := cmd.Output(); err == nil { output = string(outp) @@ -130,14 +132,14 @@ func dpkgVersion(path string) string { } func (r *OCIRuntime) pathPackage() string { - if out := rpmVersion(r.path); out != "Unknown" { + if out := rpmVersion(r.path); out != unknownPackage { return out } return dpkgVersion(r.path) } func (r *OCIRuntime) conmonPackage() string { - if out := rpmVersion(r.conmonPath); out != "Unknown" { + if out := rpmVersion(r.conmonPath); out != unknownPackage { return out } return dpkgVersion(r.conmonPath) |