diff --git a/cli/command/formatter/container_test.go b/cli/command/formatter/container_test.go index df2639bf00..6762cec615 100644 --- a/cli/command/formatter/container_test.go +++ b/cli/command/formatter/container_test.go @@ -331,7 +331,12 @@ size: 0B }, // Special headers for customized table format { - context: Context{Format: NewContainerFormat(`table {{truncate .ID 5}}\t{{json .Image}} {{.RunningFor}}/{{title .Status}}/{{pad .Ports 2 2}}.{{upper .Names}} {{lower .Status}}`, false, true)}, + context: Context{ + Format: NewContainerFormat( + `table {{truncate .ID 5}}\t{{json .Image}} {{.RunningFor}}/{{title .Status}}/{{pad .Ports 2 2}}.{{upper .Names}} {{lower .Status}}`, + false, true, + ), + }, expected: string(golden.Get(t, "container-context-write-special-headers.golden")), }, { @@ -525,7 +530,6 @@ type ports struct { expected string } -//nolint:lll func TestDisplayablePorts(t *testing.T) { cases := []ports{ { @@ -828,7 +832,7 @@ func TestDisplayablePorts(t *testing.T) { Type: "sctp", }, }, - expected: "80/tcp, 80/udp, 1024/tcp, 1024/udp, 12345/sctp, 1.1.1.1:1024->80/tcp, 1.1.1.1:1024->80/udp, 2.1.1.1:1024->80/tcp, 2.1.1.1:1024->80/udp, 1.1.1.1:80->1024/tcp, 1.1.1.1:80->1024/udp, 2.1.1.1:80->1024/tcp, 2.1.1.1:80->1024/udp", + expected: "80/tcp, 80/udp, 1024/tcp, 1024/udp, 12345/sctp, 1.1.1.1:1024->80/tcp, 1.1.1.1:1024->80/udp, 2.1.1.1:1024->80/tcp, 2.1.1.1:1024->80/udp, 1.1.1.1:80->1024/tcp, 1.1.1.1:80->1024/udp, 2.1.1.1:80->1024/tcp, 2.1.1.1:80->1024/udp", //nolint:lll,revive // ignore line-length-limit (revive) }, } diff --git a/cli/command/formatter/custom.go b/cli/command/formatter/custom.go index 043e268dbe..6910a261e1 100644 --- a/cli/command/formatter/custom.go +++ b/cli/command/formatter/custom.go @@ -32,7 +32,7 @@ type SubContext interface { type SubHeaderContext map[string]string // Label returns the header label for the specified string -func (c SubHeaderContext) Label(name string) string { +func (SubHeaderContext) Label(name string) string { n := strings.Split(name, ".") r := strings.NewReplacer("-", " ", "_", " ") h := r.Replace(n[len(n)-1]) diff --git a/cli/command/formatter/disk_usage.go b/cli/command/formatter/disk_usage.go index 18d79d08e6..1199d571f3 100644 --- a/cli/command/formatter/disk_usage.go +++ b/cli/command/formatter/disk_usage.go @@ -270,7 +270,7 @@ func (c *diskUsageImagesContext) MarshalJSON() ([]byte, error) { return MarshalJSON(c) } -func (c *diskUsageImagesContext) Type() string { +func (*diskUsageImagesContext) Type() string { return "Images" } @@ -321,7 +321,7 @@ func (c *diskUsageContainersContext) MarshalJSON() ([]byte, error) { return MarshalJSON(c) } -func (c *diskUsageContainersContext) Type() string { +func (*diskUsageContainersContext) Type() string { return "Containers" } @@ -329,7 +329,7 @@ func (c *diskUsageContainersContext) TotalCount() string { return strconv.Itoa(len(c.containers)) } -func (c *diskUsageContainersContext) isActive(ctr container.Summary) bool { +func (*diskUsageContainersContext) isActive(ctr container.Summary) bool { return strings.Contains(ctr.State, "running") || strings.Contains(ctr.State, "paused") || strings.Contains(ctr.State, "restarting") @@ -382,7 +382,7 @@ func (c *diskUsageVolumesContext) MarshalJSON() ([]byte, error) { return MarshalJSON(c) } -func (c *diskUsageVolumesContext) Type() string { +func (*diskUsageVolumesContext) Type() string { return "Local Volumes" } @@ -443,7 +443,7 @@ func (c *diskUsageBuilderContext) MarshalJSON() ([]byte, error) { return MarshalJSON(c) } -func (c *diskUsageBuilderContext) Type() string { +func (*diskUsageBuilderContext) Type() string { return "Build Cache" } diff --git a/cli/command/formatter/formatter_test.go b/cli/command/formatter/formatter_test.go index 7a95f2112e..4deb5e7f90 100644 --- a/cli/command/formatter/formatter_test.go +++ b/cli/command/formatter/formatter_test.go @@ -28,7 +28,7 @@ type fakeSubContext struct { Name string } -func (f fakeSubContext) FullHeader() any { +func (fakeSubContext) FullHeader() any { return map[string]string{"Name": "NAME"} } diff --git a/cli/command/formatter/reflect_test.go b/cli/command/formatter/reflect_test.go index 79737ec5f7..4b736eb74c 100644 --- a/cli/command/formatter/reflect_test.go +++ b/cli/command/formatter/reflect_test.go @@ -10,29 +10,29 @@ import ( type dummy struct{} -func (d *dummy) Func1() string { +func (*dummy) Func1() string { return "Func1" } -func (d *dummy) func2() string { //nolint:unused +func (*dummy) func2() string { //nolint:unused return "func2(should not be marshalled)" } -func (d *dummy) Func3() (string, int) { +func (*dummy) Func3() (string, int) { return "Func3(should not be marshalled)", -42 } -func (d *dummy) Func4() int { +func (*dummy) Func4() int { return 4 } type dummyType string -func (d *dummy) Func5() dummyType { - return dummyType("Func5") +func (*dummy) Func5() dummyType { + return "Func5" } -func (d *dummy) FullHeader() string { +func (*dummy) FullHeader() string { return "FullHeader(should not be marshalled)" }