From 4d190162efd1c8870c83214407978a379548476c Mon Sep 17 00:00:00 2001 From: Oleksandr Redko Date: Tue, 11 Nov 2025 20:43:28 +0200 Subject: [PATCH] refactor: fix modernize lint issues --- .golangci.yml | 4 ++++ .tool-versions | 2 +- markdown_test.go | 1 - pagination.go | 1 - pagination_test.go | 1 - project_variables_test.go | 2 +- request_handler.go | 2 +- request_handler_test.go | 2 +- 8 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index de06c9da..77576563 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -24,6 +24,7 @@ linters: - goconst - godoclint - misspell + - modernize - nakedret - nolintlint - revive @@ -41,6 +42,9 @@ linters: locale: US ignore-rules: - noteable + modernize: + disable: + - omitzero revive: enable-all-rules: false rules: diff --git a/.tool-versions b/.tool-versions index ea4eec6f..0f1efd88 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,5 +1,5 @@ golang 1.23 -golangci-lint 2.5.0 +golangci-lint 2.6.1 gofumpt 0.8.0 buf 1.55.1 node 24.8.0 \ No newline at end of file diff --git a/markdown_test.go b/markdown_test.go index 6c5095a3..6dd6bf04 100644 --- a/markdown_test.go +++ b/markdown_test.go @@ -36,7 +36,6 @@ func TestRender(t *testing.T) { } for _, tc := range tests { - tc := tc // pin for parallel t.Run(tc.name, func(t *testing.T) { t.Parallel() diff --git a/pagination.go b/pagination.go index 8214e84e..1549f15f 100644 --- a/pagination.go +++ b/pagination.go @@ -1,5 +1,4 @@ //go:build go1.23 -// +build go1.23 package gitlab diff --git a/pagination_test.go b/pagination_test.go index 7dff6555..c55bbaa1 100644 --- a/pagination_test.go +++ b/pagination_test.go @@ -1,5 +1,4 @@ //go:build go1.23 -// +build go1.23 package gitlab diff --git a/project_variables_test.go b/project_variables_test.go index 2438bc28..43dd1bbf 100644 --- a/project_variables_test.go +++ b/project_variables_test.go @@ -114,7 +114,7 @@ func TestProjectVariablesService_CreateVariable(t *testing.T) { testBodyJSON(t, r, map[string]string{ "description": "new variable", }) - mustWriteJSONResponse(t, w, map[string]interface{}{ + mustWriteJSONResponse(t, w, map[string]any{ "key": "NEW_VARIABLE", "value": "new value", "protected": false, diff --git a/request_handler.go b/request_handler.go index 6ead6434..0c65449c 100644 --- a/request_handler.go +++ b/request_handler.go @@ -115,7 +115,7 @@ func do[T any](client *Client, opts ...doOption) (T, *Response, error) { as T resp *Response ) - if reflect.TypeOf(as) == reflect.TypeOf(none{}) { + if reflect.TypeOf(as) == reflect.TypeFor[none]() { resp, err = client.Do(req, nil) } else { resp, err = client.Do(req, &as) diff --git a/request_handler_test.go b/request_handler_test.go index fa469b09..1180eab5 100644 --- a/request_handler_test.go +++ b/request_handler_test.go @@ -218,7 +218,7 @@ func TestDoRequestVoidSuccessPUT(t *testing.T) { mux.HandleFunc(path, func(w http.ResponseWriter, r *http.Request) { testMethod(t, r, http.MethodPut) - var reqBody map[string]interface{} + var reqBody map[string]any err := json.NewDecoder(r.Body).Decode(&reqBody) assert.NoError(t, err) assert.Equal(t, "approve", reqBody["action"]) -- GitLab