Update golangci-lint

This commit is contained in:
Ludovic Fernandez 2019-09-10 17:52:04 +02:00 committed by Traefiker Bot
parent fb8edd86d5
commit 6e8138e19b
7 changed files with 17 additions and 18 deletions

View file

@ -23,6 +23,10 @@
[linters-settings.misspell] [linters-settings.misspell]
locale = "US" locale = "US"
[linters-settings.funlen]
lines = 230 # default 60
statements = 120 # default 40
[linters] [linters]
enable-all = true enable-all = true
disable = [ disable = [
@ -37,7 +41,6 @@
"gochecknoinits", "gochecknoinits",
"gochecknoglobals", "gochecknoglobals",
"bodyclose", # Too many false-positive and panics. "bodyclose", # Too many false-positive and panics.
"typecheck", # v1.17.1 and Go1.13 => bug
] ]
[issues] [issues]
@ -50,8 +53,8 @@
"should have a package comment, unless it's in another file for this package", "should have a package comment, unless it's in another file for this package",
] ]
[[issues.exclude-rules]] [[issues.exclude-rules]]
path = ".+_test.go" path = "(.+)_test.go"
linters = ["goconst"] linters = ["goconst", "funlen"]
[[issues.exclude-rules]] [[issues.exclude-rules]]
path = "integration/.+_test.go" path = "integration/.+_test.go"
text = "Error return value of `cmd\\.Process\\.Kill` is not checked" text = "Error return value of `cmd\\.Process\\.Kill` is not checked"

View file

@ -19,7 +19,7 @@ RUN mkdir -p /usr/local/bin \
&& chmod +x /usr/local/bin/go-bindata && chmod +x /usr/local/bin/go-bindata
# Download golangci-lint binary to bin folder in $GOPATH # 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.17.1 RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.18.0
# Download golangci-lint and misspell binary to bin folder in $GOPATH # Download golangci-lint and misspell binary to bin folder in $GOPATH
RUN GO111MODULE=off go get github.com/client9/misspell/cmd/misspell RUN GO111MODULE=off go get github.com/client9/misspell/cmd/misspell

View file

@ -501,8 +501,8 @@ func (s *HTTPSSuite) TestWithClientCertificateAuthentication(c *check.C) {
// TestWithClientCertificateAuthentication // TestWithClientCertificateAuthentication
// Use two CA:s and test that clients with client signed by either of them can connect // Use two CA:s and test that clients with client signed by either of them can connect
func (s *HTTPSSuite) TestWithClientCertificateAuthenticationMultipleCAs(c *check.C) { func (s *HTTPSSuite) TestWithClientCertificateAuthenticationMultipleCAs(c *check.C) {
server1 := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, _ *http.Request) { rw.Write([]byte("server1")) })) server1 := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, _ *http.Request) { _, _ = rw.Write([]byte("server1")) }))
server2 := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, _ *http.Request) { rw.Write([]byte("server2")) })) server2 := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, _ *http.Request) { _, _ = rw.Write([]byte("server2")) }))
defer func() { defer func() {
server1.Close() server1.Close()
server2.Close() server2.Close()
@ -598,8 +598,8 @@ func (s *HTTPSSuite) TestWithClientCertificateAuthenticationMultipleCAs(c *check
// TestWithClientCertificateAuthentication // TestWithClientCertificateAuthentication
// Use two CA:s in two different files and test that clients with client signed by either of them can connect // Use two CA:s in two different files and test that clients with client signed by either of them can connect
func (s *HTTPSSuite) TestWithClientCertificateAuthenticationMultipleCAsMultipleFiles(c *check.C) { func (s *HTTPSSuite) TestWithClientCertificateAuthenticationMultipleCAsMultipleFiles(c *check.C) {
server1 := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, _ *http.Request) { rw.Write([]byte("server1")) })) server1 := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, _ *http.Request) { _, _ = rw.Write([]byte("server1")) }))
server2 := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, _ *http.Request) { rw.Write([]byte("server2")) })) server2 := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, _ *http.Request) { _, _ = rw.Write([]byte("server2")) }))
defer func() { defer func() {
server1.Close() server1.Close()
server2.Close() server2.Close()

View file

@ -2,7 +2,6 @@ package integration
import ( import (
"bytes" "bytes"
"context"
"encoding/json" "encoding/json"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
@ -745,9 +744,10 @@ func (s *SimpleSuite) TestMirrorCanceled(c *check.C) {
req, err := http.NewRequest(http.MethodGet, "http://127.0.0.1:8000/whoami", nil) req, err := http.NewRequest(http.MethodGet, "http://127.0.0.1:8000/whoami", nil)
c.Assert(err, checker.IsNil) c.Assert(err, checker.IsNil)
newCtx, _ := context.WithTimeout(req.Context(), time.Second) client := &http.Client{
req = req.WithContext(newCtx) Timeout: time.Second,
http.DefaultClient.Do(req) }
_, _ = client.Do(req)
} }
countTotal := atomic.LoadInt32(&count) countTotal := atomic.LoadInt32(&count)

View file

@ -89,6 +89,7 @@ type ForwardAuth struct {
TLS *ClientTLS `json:"tls,omitempty"` TLS *ClientTLS `json:"tls,omitempty"`
} }
// ClientTLS holds TLS specific configurations as client.
type ClientTLS struct { type ClientTLS struct {
CASecret string `json:"caSecret,omitempty"` CASecret string `json:"caSecret,omitempty"`
CAOptional bool `json:"caOptional,omitempty"` CAOptional bool `json:"caOptional,omitempty"`

View file

@ -13,11 +13,6 @@ import (
"github.com/gorilla/mux" "github.com/gorilla/mux"
) )
// chainBuilder The contract of the middleware builder
type chainBuilder interface {
BuildChain(ctx context.Context, middlewares []string) *alice.Chain
}
// NewRouteAppenderAggregator Creates a new RouteAppenderAggregator // NewRouteAppenderAggregator Creates a new RouteAppenderAggregator
func NewRouteAppenderAggregator(ctx context.Context, conf static.Configuration, func NewRouteAppenderAggregator(ctx context.Context, conf static.Configuration,
entryPointName string, runtimeConfiguration *runtime.Configuration) *RouteAppenderAggregator { entryPointName string, runtimeConfiguration *runtime.Configuration) *RouteAppenderAggregator {

View file

@ -63,7 +63,7 @@ func (m *Mirroring) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
if handler.count*100 < total*uint64(handler.percent) { if handler.count*100 < total*uint64(handler.percent) {
handler.count++ handler.count++
handler.lock.Unlock() handler.lock.Unlock()
// When a request served by m.handler is successful, req.Context will be cancelled, // When a request served by m.handler is successful, req.Context will be canceled,
// which would trigger a cancellation of the ongoing mirrored requests. // which would trigger a cancellation of the ongoing mirrored requests.
// Therefore, we give a new, non-cancellable context to each of the mirrored calls, // Therefore, we give a new, non-cancellable context to each of the mirrored calls,
// so they can terminate by themselves. // so they can terminate by themselves.