From 230c2e5cc2fe687eead59ac74c6108fefa01583b Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Tue, 15 Sep 2020 13:08:03 +0200 Subject: [PATCH] chore: update linter. --- build.Dockerfile | 2 +- integration/docker_test.go | 2 +- pkg/middlewares/customerrors/custom_errors.go | 2 +- .../passtlsclientcert/pass_tls_client_cert_test.go | 2 +- pkg/provider/marathon/config.go | 2 +- pkg/tls/certificate_store_test.go | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/build.Dockerfile b/build.Dockerfile index b0999f841..a00bb2323 100644 --- a/build.Dockerfile +++ b/build.Dockerfile @@ -19,7 +19,7 @@ RUN mkdir -p /usr/local/bin \ && chmod +x /usr/local/bin/go-bindata # Download golangci-lint binary to bin folder in $GOPATH -RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.30.0 +RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.31.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/docker_test.go b/integration/docker_test.go index eb7ce57bc..a5c09935b 100644 --- a/integration/docker_test.go +++ b/integration/docker_test.go @@ -129,7 +129,7 @@ func (s *DockerSuite) TestDefaultDockerContainers(c *check.C) { req, err := http.NewRequest(http.MethodGet, "http://127.0.0.1:8000/version", nil) c.Assert(err, checker.IsNil) - req.Host = fmt.Sprintf("%s.docker.localhost", strings.Replace(name, "_", "-", -1)) + req.Host = fmt.Sprintf("%s.docker.localhost", strings.ReplaceAll(name, "_", "-")) // FIXME Need to wait than 500 milliseconds more (for swarm or traefik to boot up ?) resp, err := try.ResponseUntilStatusCode(req, 1500*time.Millisecond, http.StatusOK) diff --git a/pkg/middlewares/customerrors/custom_errors.go b/pkg/middlewares/customerrors/custom_errors.go index 3789142e5..cfe9e4eb7 100644 --- a/pkg/middlewares/customerrors/custom_errors.go +++ b/pkg/middlewares/customerrors/custom_errors.go @@ -98,7 +98,7 @@ func (c *customErrors) ServeHTTP(rw http.ResponseWriter, req *http.Request) { var query string if len(c.backendQuery) > 0 { query = "/" + strings.TrimPrefix(c.backendQuery, "/") - query = strings.Replace(query, "{status}", strconv.Itoa(code), -1) + query = strings.ReplaceAll(query, "{status}", strconv.Itoa(code)) } pageReq, err := newRequest(backendURL + query) diff --git a/pkg/middlewares/passtlsclientcert/pass_tls_client_cert_test.go b/pkg/middlewares/passtlsclientcert/pass_tls_client_cert_test.go index 2b0328cfd..fa5541e50 100644 --- a/pkg/middlewares/passtlsclientcert/pass_tls_client_cert_test.go +++ b/pkg/middlewares/passtlsclientcert/pass_tls_client_cert_test.go @@ -586,7 +586,7 @@ WqeUSNGYV//RunTeuRDAf5OxehERb1srzBXhRZ3cZdzXbgR/`, content := sanitize(test.toSanitize) - expected := url.QueryEscape(strings.Replace(test.expected, "\n", "", -1)) + expected := url.QueryEscape(strings.ReplaceAll(test.expected, "\n", "")) assert.Equal(t, expected, content, "The sanitized certificates should be equal") }) } diff --git a/pkg/provider/marathon/config.go b/pkg/provider/marathon/config.go index f1382fd68..f0cb27a02 100644 --- a/pkg/provider/marathon/config.go +++ b/pkg/provider/marathon/config.go @@ -104,7 +104,7 @@ func (p *Provider) buildConfiguration(ctx context.Context, applications *maratho } func getServiceName(app marathon.Application) string { - return strings.Replace(strings.TrimPrefix(app.ID, "/"), "/", "_", -1) + return strings.ReplaceAll(strings.TrimPrefix(app.ID, "/"), "/", "_") } func (p *Provider) buildServiceConfiguration(ctx context.Context, app marathon.Application, extraConf configuration, conf *dynamic.HTTPConfiguration) error { diff --git a/pkg/tls/certificate_store_test.go b/pkg/tls/certificate_store_test.go index 9ee0339b6..0dd983406 100644 --- a/pkg/tls/certificate_store_test.go +++ b/pkg/tls/certificate_store_test.go @@ -96,8 +96,8 @@ func loadTestCert(certName string, uppercase bool) (*tls.Certificate, error) { } staticCert, err := tls.LoadX509KeyPair( - fmt.Sprintf("../../integration/fixtures/https/%s.cert", strings.Replace(certName, "*", replacement, -1)), - fmt.Sprintf("../../integration/fixtures/https/%s.key", strings.Replace(certName, "*", replacement, -1)), + fmt.Sprintf("../../integration/fixtures/https/%s.cert", strings.ReplaceAll(certName, "*", replacement)), + fmt.Sprintf("../../integration/fixtures/https/%s.key", strings.ReplaceAll(certName, "*", replacement)), ) if err != nil { return nil, err