From bf222d635be215e40104a1c33595ef6444e479fd Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 27 Jun 2024 23:02:00 +0200 Subject: [PATCH] fix some gofmt issues reported by goreportcard https://goreportcard.com/report/github.com/docker/docker Signed-off-by: Sebastiaan van Stijn (cherry picked from commit 6ada1cff02286a5885bdfded5a28dda454ff32d5) Signed-off-by: Sebastiaan van Stijn --- api/server/router/swarm/helpers_test.go | 4 ++-- daemon/cluster/convert/container_test.go | 8 ++++---- daemon/cluster/executor/container/container_test.go | 4 ++-- integration/image/save_test.go | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/api/server/router/swarm/helpers_test.go b/api/server/router/swarm/helpers_test.go index 688c6c8357..c34d1f02c4 100644 --- a/api/server/router/swarm/helpers_test.go +++ b/api/server/router/swarm/helpers_test.go @@ -53,7 +53,7 @@ func TestAdjustForAPIVersion(t *testing.T) { Target: "/bar", TmpfsOptions: &mount.TmpfsOptions{ Options: [][]string{ - []string{"exec"}, + {"exec"}, }, }, }, @@ -73,7 +73,7 @@ func TestAdjustForAPIVersion(t *testing.T) { adjustForAPIVersion("1.46", spec) if !reflect.DeepEqual( spec.TaskTemplate.ContainerSpec.Mounts[0].TmpfsOptions.Options, - [][]string{[]string{"exec"}}, + [][]string{{"exec"}}, ) { t.Error("TmpfsOptions.Options was stripped from spec") } diff --git a/daemon/cluster/convert/container_test.go b/daemon/cluster/convert/container_test.go index f3886f71a7..f000d6fd0d 100644 --- a/daemon/cluster/convert/container_test.go +++ b/daemon/cluster/convert/container_test.go @@ -8,8 +8,8 @@ import ( func TestTmpfsOptionsToGRPC(t *testing.T) { options := [][]string{ - []string{"noexec"}, - []string{"uid", "12345"}, + {"noexec"}, + {"uid", "12345"}, } expected := `[["noexec"],["uid","12345"]]` @@ -21,8 +21,8 @@ func TestTmpfsOptionsFromGRPC(t *testing.T) { options := `[["noexec"],["uid","12345"]]` expected := [][]string{ - []string{"noexec"}, - []string{"uid", "12345"}, + {"noexec"}, + {"uid", "12345"}, } actual := tmpfsOptionsFromGRPC(options) diff --git a/daemon/cluster/executor/container/container_test.go b/daemon/cluster/executor/container/container_test.go index 25cdc335d2..f905c26b3a 100644 --- a/daemon/cluster/executor/container/container_test.go +++ b/daemon/cluster/executor/container/container_test.go @@ -167,7 +167,7 @@ func TestTmpfsConversion(t *testing.T) { Target: "/bar", Type: mount.TypeTmpfs, TmpfsOptions: &mount.TmpfsOptions{ - Options: [][]string{[]string{"exec"}}, + Options: [][]string{{"exec"}}, }, }, }, @@ -190,7 +190,7 @@ func TestTmpfsConversion(t *testing.T) { Target: "/bar", Type: mount.TypeTmpfs, TmpfsOptions: &mount.TmpfsOptions{ - Options: [][]string{[]string{"noexec"}}, + Options: [][]string{{"noexec"}}, }, }, }, diff --git a/integration/image/save_test.go b/integration/image/save_test.go index cdc5c6e501..7981019211 100644 --- a/integration/image/save_test.go +++ b/integration/image/save_test.go @@ -108,10 +108,10 @@ func TestSaveOCI(t *testing.T) { testCases := []testCase{ // Busybox by tagged name - testCase{image: busybox, expectedContainerdRef: "docker.io/library/busybox:latest", expectedOCIRef: "latest"}, + {image: busybox, expectedContainerdRef: "docker.io/library/busybox:latest", expectedOCIRef: "latest"}, // Busybox by ID - testCase{image: inspectBusybox.ID}, + {image: inspectBusybox.ID}, } if testEnv.DaemonInfo.OSType != "windows" {