From fb4f384a2bb39a3f7da446ccb5ab9f81daa4e1ab Mon Sep 17 00:00:00 2001 From: Alexey Palazhchenko Date: Wed, 8 May 2024 13:28:17 +0400 Subject: [PATCH] Update linters configuration (#4277) --- .golangci-new.yml | 2 +- .golangci.yml | 3 ++- Taskfile.yml | 6 +----- integration/.golangci-new.yml | 2 +- integration/.golangci.yml | 3 ++- integration/Taskfile.yml | 6 +----- internal/driver/driver.go | 3 ++- tools/Taskfile.yml | 6 +----- 8 files changed, 11 insertions(+), 20 deletions(-) diff --git a/.golangci-new.yml b/.golangci-new.yml index 565540b49e70..04723c618db7 100644 --- a/.golangci-new.yml +++ b/.golangci-new.yml @@ -98,6 +98,7 @@ linters: - dogsled - dupl - durationcheck + - err113 - errchkjson - errname - execinquery @@ -111,7 +112,6 @@ linters: - gocognit - gocritic - gocyclo - - goerr113 - gofmt - gofumpt - gomnd diff --git a/.golangci.yml b/.golangci.yml index 27e6819498f7..b76de3ea8d19 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -203,7 +203,8 @@ linters-settings: no-mixed-args: true kv-only: false attr-only: true - context-only: false # https://github.com/go-simpler/sloglint/issues/29 + no-global: "all" + context: "scope" static-msg: false # TODO https://github.com/FerretDB/FerretDB/issues/3421 no-raw-keys: false # TODO https://github.com/FerretDB/FerretDB/issues/3421 key-naming-case: snake diff --git a/Taskfile.yml b/Taskfile.yml index eb4bf3ba60c3..123947f3b9d5 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -476,11 +476,7 @@ tasks: - bin/envtool{{exeExt}} shell mkdir tmp/githubcache - bin/golangci-lint{{exeExt}} run --config=.golangci.yml - bin/golangci-lint{{exeExt}} run --config=.golangci-new.yml - - # Stop CI from failing too often; see https://github.com/quasilyte/go-consistent/issues/38. - # Still, note the output and fix the issues. - - cmd: bin/go-consistent{{exeExt}} -pedantic ./cmd/... ./internal/... ./build/... ./ferretdb/... - ignore_error: true + - bin/go-consistent{{exeExt}} -pedantic ./cmd/... ./internal/... ./build/... ./ferretdb/... - go vet -vettool=bin/checkswitch{{exeExt}} ./... - go vet -vettool=bin/checkcomments{{exeExt}} ./... diff --git a/integration/.golangci-new.yml b/integration/.golangci-new.yml index f0d8b364508d..71fdfa6b38ab 100644 --- a/integration/.golangci-new.yml +++ b/integration/.golangci-new.yml @@ -90,6 +90,7 @@ linters: - dogsled - dupl - durationcheck + - err113 - errchkjson - errname - execinquery @@ -104,7 +105,6 @@ linters: - gocognit - gocritic - gocyclo - - goerr113 - gofmt - gofumpt - gomnd diff --git a/integration/.golangci.yml b/integration/.golangci.yml index 7d8e2dce5345..7216f8e44dc2 100644 --- a/integration/.golangci.yml +++ b/integration/.golangci.yml @@ -111,7 +111,8 @@ linters-settings: no-mixed-args: true kv-only: false attr-only: true - context-only: true + no-global: "all" + context: "scope" static-msg: true no-raw-keys: false # TODO https://github.com/FerretDB/FerretDB/issues/3421 key-naming-case: snake diff --git a/integration/Taskfile.yml b/integration/Taskfile.yml index be77b345f973..79939c82fcc3 100644 --- a/integration/Taskfile.yml +++ b/integration/Taskfile.yml @@ -44,11 +44,7 @@ tasks: cmds: - ../bin/golangci-lint{{exeExt}} run --config=.golangci.yml - ../bin/golangci-lint{{exeExt}} run --config=.golangci-new.yml - - # Stop CI from failing too often; see https://github.com/quasilyte/go-consistent/issues/38. - # Still, note the output and fix the issues. - - cmd: ../bin/go-consistent{{exeExt}} -pedantic ./... - ignore_error: true + - ../bin/go-consistent{{exeExt}} -pedantic ./... - go vet -vettool=../bin/checkswitch{{exeExt}} ./... - go vet -vettool=../bin/checkcomments{{exeExt}} ./... diff --git a/internal/driver/driver.go b/internal/driver/driver.go index 82e50a783bac..ffa030741b17 100644 --- a/internal/driver/driver.go +++ b/internal/driver/driver.go @@ -212,7 +212,8 @@ func (c *Conn) Request(ctx context.Context, header *wire.MsgHeader, body wire.Ms } if resHeader.ResponseTo != header.RequestID { - c.l.Error( + c.l.ErrorContext( + ctx, "response_to is not equal to request_id", slog.Int("request_id", int(header.RequestID)), slog.Int("response_id", int(resHeader.RequestID)), diff --git a/tools/Taskfile.yml b/tools/Taskfile.yml index 0acda23e3535..37d7a1e708ef 100644 --- a/tools/Taskfile.yml +++ b/tools/Taskfile.yml @@ -17,11 +17,7 @@ tasks: cmds: - ../bin/golangci-lint{{exeExt}} run --config=../.golangci.yml ./checkcomments/... ./checkdocs/... ./checkswitch/... - ../bin/golangci-lint{{exeExt}} run --config=../.golangci-new.yml ./checkcomments/... ./checkdocs/... ./checkswitch/... - - # Stop CI from failing too often; see https://github.com/quasilyte/go-consistent/issues/38. - # Still, note the output and fix the issues. - - cmd: ../bin/go-consistent{{exeExt}} -pedantic ./checkcomments/... ./checkdocs/... ./checkswitch/... - ignore_error: true + - ../bin/go-consistent{{exeExt}} -pedantic ./checkcomments/... ./checkdocs/... ./checkswitch/... - go vet -vettool=../bin/checkswitch{{exeExt}} ./checkcomments/... ./checkdocs/... ./checkswitch/... - go vet -vettool=../bin/checkcomments{{exeExt}} ./checkcomments/... ./checkdocs/... ./checkswitch/...