From 1a82061e4957800613fe85f5c019483474c2ca5b Mon Sep 17 00:00:00 2001 From: Jarek Kowalski Date: Mon, 18 Jul 2022 22:47:36 -0700 Subject: [PATCH] chore(ci): upgraded linter to 1.47.0, added 15s ReadHeaderTimeout in web server (#2206) --- .golangci.yml | 2 ++ cli/command_server_start.go | 3 ++- internal/mount/mount_webdav.go | 4 +++- tests/tools/kopiarunner/kopiarun_test.go | 5 +---- tools/gettool/checksums.txt | 12 ++++++------ tools/tools.mk | 2 +- 6 files changed, 15 insertions(+), 13 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 02b35848e..ba52c4c30 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -74,6 +74,7 @@ linters: - exhaustruct - gochecknoinits - golint + - gci - ifshort - interfacer - ireturn # this one may be interesting to control allocations @@ -81,6 +82,7 @@ linters: - nilnil - nlreturn - nonamedreturns + - nosnakecase - paralleltest - prealloc - scopelint diff --git a/cli/command_server_start.go b/cli/command_server_start.go index 35d660933..0df09727d 100644 --- a/cli/command_server_start.go +++ b/cli/command_server_start.go @@ -184,7 +184,8 @@ func (c *commandServerStart) run(ctx context.Context) error { } httpServer := &http.Server{ - Addr: stripProtocol(c.sf.serverAddress), + ReadHeaderTimeout: 15 * time.Second, // nolint:gomnd + Addr: stripProtocol(c.sf.serverAddress), BaseContext: func(l net.Listener) context.Context { return ctx }, diff --git a/internal/mount/mount_webdav.go b/internal/mount/mount_webdav.go index 308f8a2d9..a6f592128 100644 --- a/internal/mount/mount_webdav.go +++ b/internal/mount/mount_webdav.go @@ -5,6 +5,7 @@ "net" "net/http" "os" + "time" "github.com/pkg/errors" "golang.org/x/net/webdav" @@ -51,7 +52,8 @@ func DirectoryWebDAV(ctx context.Context, entry fs.Directory) (Controller, error } srv := &http.Server{ - Handler: mux, + ReadHeaderTimeout: 15 * time.Second, // nolint:gomnd + Handler: mux, } done := make(chan struct{}) diff --git a/tests/tools/kopiarunner/kopiarun_test.go b/tests/tools/kopiarunner/kopiarun_test.go index e671f996e..8336e125d 100644 --- a/tests/tools/kopiarunner/kopiarun_test.go +++ b/tests/tools/kopiarunner/kopiarun_test.go @@ -55,10 +55,7 @@ func TestKopiaRunner(t *testing.T) { }, } { t.Run(tt.name, func(t *testing.T) { - err := os.Setenv("KOPIA_EXE", tt.exe) - if err != nil { - t.Fatal("Unable to set environment variable KOPIA_EXE") - } + t.Setenv("KOPIA_EXE", tt.exe) runner, err := NewRunner("") if (err != nil) != tt.expNewRunnerErr { diff --git a/tools/gettool/checksums.txt b/tools/gettool/checksums.txt index 4e1f5516f..1b72c9a7c 100644 --- a/tools/gettool/checksums.txt +++ b/tools/gettool/checksums.txt @@ -8,12 +8,12 @@ https://github.com/gohugoio/hugo/releases/download/v0.89.2/hugo_extended_0.89.2_ https://github.com/gohugoio/hugo/releases/download/v0.89.2/hugo_extended_0.89.2_macOS-64bit.tar.gz: f9185f6d14eb84d9029d59cdd8a977f2f0be334c4f9d38f2099e56a0c0734731 https://github.com/gohugoio/hugo/releases/download/v0.89.2/hugo_extended_0.89.2_macOS-ARM64.tar.gz: 99a5b4738528d4858a0237199eabc7aee77674c8c7edcfe269efb4b515566cec https://github.com/gohugoio/hugo/releases/download/v0.89.2/hugo_extended_0.89.2_windows-64bit.zip: 8d79db4f24fbf023c64862c37d09291ac216875dad91e71dd8753cb5883e4274 -https://github.com/golangci/golangci-lint/releases/download/v1.46.2/golangci-lint-1.46.2-darwin-amd64.tar.gz: 658078aaaf7608693f37c4cf1380b2af418ab8b2d23fdb33e7e2d4339328590e -https://github.com/golangci/golangci-lint/releases/download/v1.46.2/golangci-lint-1.46.2-darwin-arm64.tar.gz: 81f9b4afd62ec5e612ef8bc3b1d612a88b56ff289874831845cdad394427385f -https://github.com/golangci/golangci-lint/releases/download/v1.46.2/golangci-lint-1.46.2-linux-amd64.tar.gz: 242cd4f2d6ac0556e315192e8555784d13da5d1874e51304711570769c4f2b9b -https://github.com/golangci/golangci-lint/releases/download/v1.46.2/golangci-lint-1.46.2-linux-arm64.tar.gz: ff5448ada2b3982581984d64b0dec614dba0a3ea4cab2d6a343c77927fc89f7e -https://github.com/golangci/golangci-lint/releases/download/v1.46.2/golangci-lint-1.46.2-linux-armv6.tar.gz: 177f5210ef04aee282bfbc6ec519d36af5fb7d2b2c8d3f4ea5e59fdba71b0a27 -https://github.com/golangci/golangci-lint/releases/download/v1.46.2/golangci-lint-1.46.2-windows-amd64.zip: 604acc1378a566abb0eac799362f3a37b7fcb5fa2268aeb2d5d954c829367301 +https://github.com/golangci/golangci-lint/releases/download/v1.47.0/golangci-lint-1.47.0-darwin-amd64.tar.gz: 9bf19d01df5d274f137a4df1dc1f70d37d70eea613936436fa41eda93ed05bcb +https://github.com/golangci/golangci-lint/releases/download/v1.47.0/golangci-lint-1.47.0-darwin-arm64.tar.gz: 0eea96192b4e5c771bb9fee0950bc7d88f4c04880e1a7e717a79f7a5eb794ba2 +https://github.com/golangci/golangci-lint/releases/download/v1.47.0/golangci-lint-1.47.0-linux-amd64.tar.gz: b8885fdea31b63e6b016898e8ba92283a55d3b744d2474faba44cf053d0ecdef +https://github.com/golangci/golangci-lint/releases/download/v1.47.0/golangci-lint-1.47.0-linux-arm64.tar.gz: 49ba83fccaa4e79ca4207dab065434058b238cf7146a783a58a3f6380354ee8b +https://github.com/golangci/golangci-lint/releases/download/v1.47.0/golangci-lint-1.47.0-linux-armv6.tar.gz: e3e8df724a48f8ec03640abb629f2bb64f66caac133c95083f9644f6aa6631c3 +https://github.com/golangci/golangci-lint/releases/download/v1.47.0/golangci-lint-1.47.0-windows-amd64.zip: d9475be660217fb5f8131a12beb564e4bb650f056c15ff0c54757a5ce8877d66 https://github.com/goreleaser/goreleaser/releases/download/v0.176.0/goreleaser_Darwin_arm64.tar.gz: 1f95e6561974f4766d8833438b646b06930563ca9867447ea03edb623d876c75 https://github.com/goreleaser/goreleaser/releases/download/v0.176.0/goreleaser_Darwin_x86_64.tar.gz: 17ecad881a50e32f033da5a200c8417d37cae70f09e925645452937998aca506 https://github.com/goreleaser/goreleaser/releases/download/v0.176.0/goreleaser_Linux_arm64.tar.gz: 8bf2a9b9e84498bfa239f2fe91b2d555642c87ab9d3f5d37f29e6e97116910a3 diff --git a/tools/tools.mk b/tools/tools.mk index b199c1b6b..432f57af0 100644 --- a/tools/tools.mk +++ b/tools/tools.mk @@ -102,7 +102,7 @@ retry:= endif # tool versions -GOLANGCI_LINT_VERSION=1.46.2 +GOLANGCI_LINT_VERSION=1.47.0 CHECKLOCKS_VERSION=release-20220314.0 NODE_VERSION=16.13.0 HUGO_VERSION=0.89.2