From 371b6e3c867df5462c1434b19038f10ba22a10b9 Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Tue, 15 Feb 2022 14:56:53 +0100 Subject: [PATCH] chore: update linter --- .github/workflows/validate.yaml | 2 +- .golangci.toml | 2 ++ .semaphore/semaphore.yml | 2 +- build.Dockerfile | 2 +- integration/consul_catalog_test.go | 1 - pkg/config/runtime/runtime_http_test.go | 1 - pkg/config/runtime/runtime_tcp_test.go | 1 - pkg/config/runtime/runtime_udp_test.go | 1 - pkg/middlewares/stripprefix/strip_prefix_test.go | 1 - pkg/provider/kubernetes/crd/client.go | 2 -- pkg/provider/kubernetes/gateway/client.go | 2 -- pkg/server/router/udp/router_test.go | 2 -- 12 files changed, 5 insertions(+), 14 deletions(-) diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index e24e1a40e..5fb080436 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -7,7 +7,7 @@ on: env: GO_VERSION: 1.17 - GOLANGCI_LINT_VERSION: v1.43.0 + GOLANGCI_LINT_VERSION: v1.44.0 MISSSPELL_VERSION: v0.3.4 PRE_TARGET: "" diff --git a/.golangci.toml b/.golangci.toml index ff16616fe..73908f11c 100644 --- a/.golangci.toml +++ b/.golangci.toml @@ -102,6 +102,8 @@ "nilnil", # not relevant "ireturn", # not relevant "contextcheck", # too many false-positive + "containedctx", # too many false-positive + "maintidx", # kind of duplicate of gocyclo ] [issues] diff --git a/.semaphore/semaphore.yml b/.semaphore/semaphore.yml index 9c66efc4f..52f359b13 100644 --- a/.semaphore/semaphore.yml +++ b/.semaphore/semaphore.yml @@ -25,7 +25,7 @@ global_job_config: - export "PATH=${GOPATH}/bin:${PATH}" - mkdir -vp "${SEMAPHORE_GIT_DIR}" "${GOPATH}/bin" - export GOPROXY=https://proxy.golang.org,direct - - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "${GOPATH}/bin" v1.43.0 + - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "${GOPATH}/bin" v1.44.0 - curl -sSfL https://gist.githubusercontent.com/traefiker/6d7ac019c11d011e4f131bb2cca8900e/raw/goreleaser.sh | bash -s -- -b "${GOPATH}/bin" - checkout - cache restore traefik-$(checksum go.sum) diff --git a/build.Dockerfile b/build.Dockerfile index db189b940..3025a75e9 100644 --- a/build.Dockerfile +++ b/build.Dockerfile @@ -14,7 +14,7 @@ RUN mkdir -p /usr/local/bin \ | tar -xzC /usr/local/bin --transform 's#^.+/##x' # Download golangci-lint binary to bin folder in $GOPATH -RUN curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | bash -s -- -b $GOPATH/bin v1.43.0 +RUN curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | bash -s -- -b $GOPATH/bin v1.44.0 # Download misspell binary to bin folder in $GOPATH RUN curl -sfL https://raw.githubusercontent.com/client9/misspell/master/install-misspell.sh | bash -s -- -b $GOPATH/bin v0.3.4 diff --git a/integration/consul_catalog_test.go b/integration/consul_catalog_test.go index 11b6fbf68..55f33f1dc 100644 --- a/integration/consul_catalog_test.go +++ b/integration/consul_catalog_test.go @@ -277,7 +277,6 @@ func (s *ConsulCatalogSuite) TestDefaultConsulService(c *check.C) { ConsulAddress string DefaultRule string }{ - ConsulAddress: s.consulURL, DefaultRule: "Host(`{{ normalize .Name }}.consul.localhost`)", } diff --git a/pkg/config/runtime/runtime_http_test.go b/pkg/config/runtime/runtime_http_test.go index dfb77d314..9ac028bfb 100644 --- a/pkg/config/runtime/runtime_http_test.go +++ b/pkg/config/runtime/runtime_http_test.go @@ -186,7 +186,6 @@ func TestGetRoutersByEntryPoints(t *testing.T) { "webs": { "bar": { Router: &dynamic.Router{ - EntryPoints: []string{"webs"}, Service: "bar-service@myprovider", Rule: "Host(`foo.bar`)", diff --git a/pkg/config/runtime/runtime_tcp_test.go b/pkg/config/runtime/runtime_tcp_test.go index 0bd51e58b..067e9ee09 100644 --- a/pkg/config/runtime/runtime_tcp_test.go +++ b/pkg/config/runtime/runtime_tcp_test.go @@ -186,7 +186,6 @@ func TestGetTCPRoutersByEntryPoints(t *testing.T) { "webs": { "bar": { TCPRouter: &dynamic.TCPRouter{ - EntryPoints: []string{"webs"}, Service: "bar-service@myprovider", Rule: "HostSNI(`foo.bar`)", diff --git a/pkg/config/runtime/runtime_udp_test.go b/pkg/config/runtime/runtime_udp_test.go index 10c1e80cb..87fe2476f 100644 --- a/pkg/config/runtime/runtime_udp_test.go +++ b/pkg/config/runtime/runtime_udp_test.go @@ -169,7 +169,6 @@ func TestGetUDPRoutersByEntryPoints(t *testing.T) { "webs": { "bar": { UDPRouter: &dynamic.UDPRouter{ - EntryPoints: []string{"webs"}, Service: "bar-service@myprovider", }, diff --git a/pkg/middlewares/stripprefix/strip_prefix_test.go b/pkg/middlewares/stripprefix/strip_prefix_test.go index 717acdef3..5c9d7171e 100644 --- a/pkg/middlewares/stripprefix/strip_prefix_test.go +++ b/pkg/middlewares/stripprefix/strip_prefix_test.go @@ -126,7 +126,6 @@ func TestStripPrefix(t *testing.T) { { desc: "earlier prefix matching", config: dynamic.StripPrefix{ - Prefixes: []string{"/stat", "/stat/us"}, }, path: "/stat/us", diff --git a/pkg/provider/kubernetes/crd/client.go b/pkg/provider/kubernetes/crd/client.go index 549ae575d..4dfd4d8a3 100644 --- a/pkg/provider/kubernetes/crd/client.go +++ b/pkg/provider/kubernetes/crd/client.go @@ -31,7 +31,6 @@ const resyncPeriod = 10 * time.Minute // The stores can then be accessed via the Get* functions. type Client interface { WatchAll(namespaces []string, stopCh <-chan struct{}) (<-chan interface{}, error) - GetIngressRoutes() []*v1alpha1.IngressRoute GetIngressRouteTCPs() []*v1alpha1.IngressRouteTCP GetIngressRouteUDPs() []*v1alpha1.IngressRouteUDP @@ -42,7 +41,6 @@ type Client interface { GetTLSOptions() []*v1alpha1.TLSOption GetServersTransports() []*v1alpha1.ServersTransport GetTLSStores() []*v1alpha1.TLSStore - GetService(namespace, name string) (*corev1.Service, bool, error) GetSecret(namespace, name string) (*corev1.Secret, bool, error) GetEndpoints(namespace, name string) (*corev1.Endpoints, bool, error) diff --git a/pkg/provider/kubernetes/gateway/client.go b/pkg/provider/kubernetes/gateway/client.go index db7715d62..e8317e45f 100644 --- a/pkg/provider/kubernetes/gateway/client.go +++ b/pkg/provider/kubernetes/gateway/client.go @@ -50,7 +50,6 @@ func (reh *resourceEventHandler) OnDelete(obj interface{}) { // The stores can then be accessed via the Get* functions. type Client interface { WatchAll(namespaces []string, stopCh <-chan struct{}) (<-chan interface{}, error) - GetGatewayClasses() ([]*v1alpha2.GatewayClass, error) UpdateGatewayStatus(gateway *v1alpha2.Gateway, gatewayStatus v1alpha2.GatewayStatus) error UpdateGatewayClassStatus(gatewayClass *v1alpha2.GatewayClass, condition metav1.Condition) error @@ -58,7 +57,6 @@ type Client interface { GetHTTPRoutes(namespaces []string) ([]*v1alpha2.HTTPRoute, error) GetTCPRoutes(namespaces []string) ([]*v1alpha2.TCPRoute, error) GetTLSRoutes(namespaces []string) ([]*v1alpha2.TLSRoute, error) - GetService(namespace, name string) (*corev1.Service, bool, error) GetSecret(namespace, name string) (*corev1.Secret, bool, error) GetEndpoints(namespace, name string) (*corev1.Endpoints, bool, error) diff --git a/pkg/server/router/udp/router_test.go b/pkg/server/router/udp/router_test.go index 76451cd30..d29d7d2d6 100644 --- a/pkg/server/router/udp/router_test.go +++ b/pkg/server/router/udp/router_test.go @@ -46,7 +46,6 @@ func TestRuntimeConfiguration(t *testing.T) { }, "bar": { UDPRouter: &dynamic.UDPRouter{ - EntryPoints: []string{"web"}, Service: "foo-service", }, @@ -78,7 +77,6 @@ func TestRuntimeConfiguration(t *testing.T) { }, "bar": { UDPRouter: &dynamic.UDPRouter{ - EntryPoints: []string{"web"}, Service: "foo-service", },