From 3387422bf9dc7450dbbafd86f7b2dfff989d1064 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Mon, 30 Nov 2020 10:39:59 -0800 Subject: [PATCH] libct/int: fix "simple" linter warnings This fixes the following warnings: > libcontainer/integration/exec_test.go:369:18: S1030: should use stdout.String() instead of string(stdout.Bytes()) (gosimple) > outputStatus := string(stdout.Bytes()) > ^ > libcontainer/integration/exec_test.go:422:18: S1030: should use stdout.String() instead of string(stdout.Bytes()) (gosimple) > outputStatus := string(stdout.Bytes()) > ^ > libcontainer/integration/exec_test.go:486:18: S1030: should use stdout.String() instead of string(stdout.Bytes()) (gosimple) > outputGroups := string(stdout.Bytes()) > ^ > libcontainer/integration/execin_test.go:191:18: S1030: should use stdout.String() instead of string(stdout.Bytes()) (gosimple) > outputGroups := string(stdout.Bytes()) > ^ > libcontainer/integration/execin_test.go:474:9: S1030: should use stdout.String() instead of string(stdout.Bytes()) (gosimple) > out := string(stdout.Bytes()) > ^ Signed-off-by: Kir Kolyshkin --- libcontainer/integration/exec_test.go | 10 +++++----- libcontainer/integration/execin_test.go | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libcontainer/integration/exec_test.go b/libcontainer/integration/exec_test.go index c583901d8..a46f0a928 100644 --- a/libcontainer/integration/exec_test.go +++ b/libcontainer/integration/exec_test.go @@ -366,7 +366,7 @@ func TestProcessEmptyCaps(t *testing.T) { // Wait for process waitProcess(&pconfig, t) - outputStatus := string(stdout.Bytes()) + outputStatus := stdout.String() lines := strings.Split(outputStatus, "\n") @@ -419,7 +419,7 @@ func TestProcessCaps(t *testing.T) { // Wait for process waitProcess(&pconfig, t) - outputStatus := string(stdout.Bytes()) + outputStatus := stdout.String() lines := strings.Split(outputStatus, "\n") @@ -483,7 +483,7 @@ func TestAdditionalGroups(t *testing.T) { // Wait for process waitProcess(&pconfig, t) - outputGroups := string(stdout.Bytes()) + outputGroups := stdout.String() // Check that the groups output has the groups that we specified if !strings.Contains(outputGroups, "audio") { @@ -1082,7 +1082,7 @@ func TestSysctl(t *testing.T) { // Wait for process waitProcess(&pconfig, t) - shmmniOutput := string(bytes.TrimSpace(stdout.Bytes())) + shmmniOutput := strings.TrimSpace(stdout.String()) if shmmniOutput != "8192" { t.Fatalf("kernel.shmmni property expected to be 8192, but is %s", shmmniOutput) } @@ -1210,7 +1210,7 @@ func TestOomScoreAdj(t *testing.T) { // Wait for process waitProcess(&pconfig, t) - outputOomScoreAdj := string(bytes.TrimSpace(stdout.Bytes())) + outputOomScoreAdj := strings.TrimSpace(stdout.String()) // Check that the oom_score_adj matches the value that was set as part of config. if outputOomScoreAdj != strconv.Itoa(*config.OomScoreAdj) { diff --git a/libcontainer/integration/execin_test.go b/libcontainer/integration/execin_test.go index 583faa29f..72de06bcc 100644 --- a/libcontainer/integration/execin_test.go +++ b/libcontainer/integration/execin_test.go @@ -188,7 +188,7 @@ func TestExecInAdditionalGroups(t *testing.T) { stdinW.Close() waitProcess(process, t) - outputGroups := string(stdout.Bytes()) + outputGroups := stdout.String() // Check that the groups output has the groups that we specified if !strings.Contains(outputGroups, "audio") { @@ -471,7 +471,7 @@ func TestExecinPassExtraFiles(t *testing.T) { stdinW.Close() waitProcess(process, t) - out := string(stdout.Bytes()) + out := stdout.String() // fd 5 is the directory handle for /proc/$$/fd if out != "0 1 2 3 4 5" { t.Fatalf("expected to have the file descriptors '0 1 2 3 4 5' passed to exec, got '%s'", out)