From 3e44cc4d00e0e8e2ea2fde800142a2c63909425a Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 17 Feb 2025 14:19:54 +0100 Subject: [PATCH] cli/command/image: fix "unused-receiver", "line-length-limit" linting cli/command/image/remove_test.go:24:7: unused-receiver: method receiver 'n' is not referenced in method's body, consider removing or renaming it as _ (revive) func (n notFound) NotFound() {} ^ cli/command/image/formatter_history_test.go:110: line-length-limit: line is 558 characters, out of limit 200 (revive) withTabs := `/bin/sh -c apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62 && echo "deb http://nginx.org/packages/mainline/debian/ jessie nginx" >> /etc/apt/sources.list && apt-get update && apt-get install --no-install-recommends --no-install-suggests -y ca-certificates nginx=${NGINX_VERSION} nginx-module-xslt nginx-module-geoip nginx-module-image-filter nginx-module-perl nginx-module-njs gettext-base && rm -rf /var/lib/apt/lists/*` //nolint:lll cli/command/image/formatter_history_test.go:111: line-length-limit: line is 552 characters, out of limit 200 (revive) expected := `/bin/sh -c apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62 && echo "deb http://nginx.org/packages/mainline/debian/ jessie nginx" >> /etc/apt/sources.list && apt-get update && apt-get install --no-install-recommends --no-install-suggests -y ca-certificates nginx=${NGINX_VERSION} nginx-module-xslt nginx-module-geoip nginx-module-image-filter nginx-module-perl nginx-module-njs gettext-base && rm -rf /var/lib/apt/lists/*` //nolint:lll Signed-off-by: Sebastiaan van Stijn --- cli/command/image/formatter_history_test.go | 10 +++++----- cli/command/image/remove_test.go | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cli/command/image/formatter_history_test.go b/cli/command/image/formatter_history_test.go index cff2f7f612..21afa94a1f 100644 --- a/cli/command/image/formatter_history_test.go +++ b/cli/command/image/formatter_history_test.go @@ -107,8 +107,8 @@ func TestHistoryContext_CreatedSince(t *testing.T) { } func TestHistoryContext_CreatedBy(t *testing.T) { - withTabs := `/bin/sh -c apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62 && echo "deb http://nginx.org/packages/mainline/debian/ jessie nginx" >> /etc/apt/sources.list && apt-get update && apt-get install --no-install-recommends --no-install-suggests -y ca-certificates nginx=${NGINX_VERSION} nginx-module-xslt nginx-module-geoip nginx-module-image-filter nginx-module-perl nginx-module-njs gettext-base && rm -rf /var/lib/apt/lists/*` //nolint:lll - expected := `/bin/sh -c apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62 && echo "deb http://nginx.org/packages/mainline/debian/ jessie nginx" >> /etc/apt/sources.list && apt-get update && apt-get install --no-install-recommends --no-install-suggests -y ca-certificates nginx=${NGINX_VERSION} nginx-module-xslt nginx-module-geoip nginx-module-image-filter nginx-module-perl nginx-module-njs gettext-base && rm -rf /var/lib/apt/lists/*` //nolint:lll + const withTabs = `/bin/sh -c apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62 && echo "deb http://nginx.org/packages/mainline/debian/ jessie nginx" >> /etc/apt/sources.list && apt-get update && apt-get install --no-install-recommends --no-install-suggests -y ca-certificates nginx=${NGINX_VERSION} nginx-module-xslt nginx-module-geoip nginx-module-image-filter nginx-module-perl nginx-module-njs gettext-base && rm -rf /var/lib/apt/lists/*` //nolint:lll,revive + const expected = `/bin/sh -c apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62 && echo "deb http://nginx.org/packages/mainline/debian/ jessie nginx" >> /etc/apt/sources.list && apt-get update && apt-get install --no-install-recommends --no-install-suggests -y ca-certificates nginx=${NGINX_VERSION} nginx-module-xslt nginx-module-geoip nginx-module-image-filter nginx-module-perl nginx-module-njs gettext-base && rm -rf /var/lib/apt/lists/*` //nolint:lll,revive var ctx historyContext cases := []historyCase{ @@ -138,8 +138,8 @@ func TestHistoryContext_CreatedBy(t *testing.T) { } func TestHistoryContext_Size(t *testing.T) { - size := int64(182964289) - expected := "183MB" + const size = int64(182964289) + const expected = "183MB" var ctx historyContext cases := []historyCase{ @@ -170,7 +170,7 @@ func TestHistoryContext_Size(t *testing.T) { } func TestHistoryContext_Comment(t *testing.T) { - comment := "Some comment" + const comment = "Some comment" var ctx historyContext cases := []historyCase{ diff --git a/cli/command/image/remove_test.go b/cli/command/image/remove_test.go index dc9af57f38..16c0a3c4a1 100644 --- a/cli/command/image/remove_test.go +++ b/cli/command/image/remove_test.go @@ -21,7 +21,7 @@ func (n notFound) Error() string { return "Error: No such image: " + n.imageID } -func (n notFound) NotFound() {} +func (notFound) NotFound() {} func TestNewRemoveCommandAlias(t *testing.T) { cmd := newRemoveCommand(test.NewFakeCli(&fakeClient{}))