From 4b828575e8c9b28b30fbb09ab28326382a76e907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Wysoki=C5=84ski?= Date: Thu, 21 Mar 2024 05:56:01 +0000 Subject: [PATCH] chore(deps): update golangci/golangci-lint to v1.57 (#32) Reviewed-on: https://gitea.dwysokinski.me/twhelp/corev3/pulls/32 --- .golangci.yml | 18 ++++++++++++++++-- .pre-commit-config.yaml | 2 +- .woodpecker/test.yml | 2 +- Makefile | 2 +- internal/adapter/bun_utils.go | 4 ++-- internal/bun/buntest/testing_tb.go | 2 +- internal/domain/domaintest/testing_tb.go | 2 +- internal/watermill/watermilltest/testing_tb.go | 2 +- 8 files changed, 24 insertions(+), 10 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index daf0cf0..1e12fb8 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -59,6 +59,8 @@ linters: - revive - gomnd - forbidigo + - copyloopvar + - intrange linters-settings: gocyclo: @@ -80,6 +82,7 @@ linters-settings: govet: enable: - asmdecl + - appends - assign - atomic - atomicalign @@ -114,6 +117,8 @@ linters-settings: - unsafeptr - unusedresult - unusedwrite + - slog + - defers testifylint: enable-all: true sloglint: @@ -478,9 +483,18 @@ linters-settings: disabled: false # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#waitgroup-by-value - name: waitgroup-by-value - severity: warning + severity: error + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unchecked-type-assertion + - name: unchecked-type-assertion + severity: error + disabled: false + arguments: + - acceptIgnoredAssertionResult: true + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#use-any + - name: use-any + severity: error disabled: false - issues: exclude-rules: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5d9b57a..7736d32 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,7 @@ repos: stages: [commit-msg] additional_dependencies: ["@commitlint/config-conventional"] - repo: https://github.com/golangci/golangci-lint - rev: v1.56.2 + rev: v1.57.1 hooks: - id: golangci-lint - repo: https://github.com/hadolint/hadolint diff --git a/.woodpecker/test.yml b/.woodpecker/test.yml index b97f1eb..2813ecc 100644 --- a/.woodpecker/test.yml +++ b/.woodpecker/test.yml @@ -42,7 +42,7 @@ steps: - go test -race -coverprofile=coverage.txt -covermode=atomic ./... lint: - image: golangci/golangci-lint:v1.56 + image: golangci/golangci-lint:v1.57 pull: true depends_on: - generate diff --git a/Makefile b/Makefile index 8f6c460..8228346 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ install-git-hooks: .PHONY: install-golangci-lint install-golangci-lint: @echo "Installing github.com/golangci/golangci-lint..." - @(test -f $(GOLANGCI_LINT_PATH) && echo "github.com/golangci/golangci-lint is already installed. Skipping...") || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN) v1.56.2 + @(test -f $(GOLANGCI_LINT_PATH) && echo "github.com/golangci/golangci-lint is already installed. Skipping...") || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN) v1.57.1 .PHONY: install-oapi-codegen install-oapi-codegen: diff --git a/internal/adapter/bun_utils.go b/internal/adapter/bun_utils.go index 126fdd1..f89e6b2 100644 --- a/internal/adapter/bun_utils.go +++ b/internal/adapter/bun_utils.go @@ -84,11 +84,11 @@ func (a cursorPaginationApplier) apply(q *bun.SelectQuery) *bun.SelectQuery { // based on https://github.com/prisma/prisma/issues/19159#issuecomment-1713389245 return q.WhereGroup(" OR ", func(q *bun.SelectQuery) *bun.SelectQuery { - for i := 0; i < dataLen; i++ { + for i := range dataLen { q.WhereGroup(" OR ", func(q *bun.SelectQuery) *bun.SelectQuery { current := a.data[i] - for j := 0; j < i; j++ { + for j := range i { prev := a.data[j] q = q.Where("? = ?", prev.column, prev.value) } diff --git a/internal/bun/buntest/testing_tb.go b/internal/bun/buntest/testing_tb.go index a838dcf..cc54e97 100644 --- a/internal/bun/buntest/testing_tb.go +++ b/internal/bun/buntest/testing_tb.go @@ -3,7 +3,7 @@ package buntest // TestingTB is a subset of the API provided by both *testing.T and *testing.B. type TestingTB interface { Helper() - Errorf(format string, args ...interface{}) + Errorf(format string, args ...any) FailNow() Cleanup(f func()) } diff --git a/internal/domain/domaintest/testing_tb.go b/internal/domain/domaintest/testing_tb.go index a3d8f7c..5b9ccc6 100644 --- a/internal/domain/domaintest/testing_tb.go +++ b/internal/domain/domaintest/testing_tb.go @@ -3,7 +3,7 @@ package domaintest // TestingTB is a subset of the API provided by both *testing.T and *testing.B. type TestingTB interface { Helper() - Errorf(format string, args ...interface{}) + Errorf(format string, args ...any) FailNow() Cleanup(f func()) } diff --git a/internal/watermill/watermilltest/testing_tb.go b/internal/watermill/watermilltest/testing_tb.go index 1e6b97d..abf02fb 100644 --- a/internal/watermill/watermilltest/testing_tb.go +++ b/internal/watermill/watermilltest/testing_tb.go @@ -3,7 +3,7 @@ package watermilltest // TestingTB is a subset of the API provided by both *testing.T and *testing.B. type TestingTB interface { Helper() - Errorf(format string, args ...interface{}) + Errorf(format string, args ...any) FailNow() Cleanup(f func()) }