From 688986fbc705bc7672e4b638d85764c9bf4f2272 Mon Sep 17 00:00:00 2001 From: Vladimir Dementyev Date: Wed, 10 Aug 2022 19:15:21 -0400 Subject: [PATCH] chore: upgrade golangci-lint --- Makefile | 2 +- pubsub/http.go | 4 ++-- server/server.go | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 661813c8..5383de4a 100644 --- a/Makefile +++ b/Makefile @@ -134,7 +134,7 @@ gen-ssl: bin/golangci-lint: @test -x $$(go env GOPATH)/bin/golangci-lint || \ - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH)/bin v1.46.2 + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH)/bin v1.48.0 lint: bin/golangci-lint $$(go env GOPATH)/bin/golangci-lint run diff --git a/pubsub/http.go b/pubsub/http.go index 8fbef462..a30dd587 100644 --- a/pubsub/http.go +++ b/pubsub/http.go @@ -2,7 +2,7 @@ package pubsub import ( "fmt" - "io/ioutil" + "io" "net/http" "strconv" @@ -100,7 +100,7 @@ func (s *HTTPSubscriber) Handler(w http.ResponseWriter, r *http.Request) { } } - body, err := ioutil.ReadAll(r.Body) + body, err := io.ReadAll(r.Body) if err != nil { s.log.Error("Failed to read request body") diff --git a/server/server.go b/server/server.go index 60ef52fb..7d3b9d2c 100644 --- a/server/server.go +++ b/server/server.go @@ -8,6 +8,7 @@ import ( "net" "net/http" "sync" + "time" "github.com/apex/log" "golang.org/x/net/netutil" @@ -59,7 +60,7 @@ func NewServer(host string, port string, ssl *SSLConfig, maxConn int) (*HTTPServ mux := http.NewServeMux() addr := net.JoinHostPort(host, port) - server := &http.Server{Addr: addr, Handler: mux} + server := &http.Server{Addr: addr, Handler: mux, ReadHeaderTimeout: 5 * time.Second} secured := (ssl != nil) && ssl.Available()