chore(deps): bump tool deps and pin, update golangci-lint (#37574)

1. Pin all makefile go deps to exact version, renovate will bump them in the future
2. Bump all deps and golangci-lint and fix all new issues, most are from modernize

Signed-off-by: silverwind <me@silverwind.io>
Co-authored-by: Claude (Opus 4.7) <noreply@anthropic.com>
This commit is contained in:
silverwind
2026-05-08 04:49:34 +00:00
committed by GitHub
co-authored by Claude
parent b4085c7e3c
commit 82d40296b0
11 changed files with 24 additions and 24 deletions
+7 -7
View File
@@ -11,15 +11,15 @@ COMMA := ,
XGO_VERSION := go-1.26.x XGO_VERSION := go-1.26.x
AIR_PACKAGE ?= github.com/air-verse/air@v1 # renovate: datasource=go AIR_PACKAGE ?= github.com/air-verse/air@v1.65.1 # renovate: datasource=go
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/v3/cmd/editorconfig-checker@v3 # renovate: datasource=go EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/v3/cmd/editorconfig-checker@v3.6.1 # renovate: datasource=go
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.11.4 # renovate: datasource=go GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.12.2 # renovate: datasource=go
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/gxz@v0.5.15 # renovate: datasource=go GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/gxz@v0.5.15 # renovate: datasource=go
MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/misspell@v0.8.0 # renovate: datasource=go MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/misspell@v0.8.0 # renovate: datasource=go
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.33.1 # renovate: datasource=go SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.33.2 # renovate: datasource=go
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest XGO_PACKAGE ?= src.techknowlogick.com/xgo@v1.9.0 # renovate: datasource=go
GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@v1 # renovate: datasource=go GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@v1.3.0 # renovate: datasource=go
ACTIONLINT_PACKAGE ?= github.com/rhysd/actionlint/cmd/actionlint@v1.7.11 # renovate: datasource=go ACTIONLINT_PACKAGE ?= github.com/rhysd/actionlint/cmd/actionlint@v1.7.12 # renovate: datasource=go
HAS_GO := $(shell hash $(GO) > /dev/null 2>&1 && echo yes) HAS_GO := $(shell hash $(GO) > /dev/null 2>&1 && echo yes)
ifeq ($(HAS_GO), yes) ifeq ($(HAS_GO), yes)
+1 -1
View File
@@ -100,7 +100,7 @@ var registeredConfigs = map[Type]func() Config{}
// RegisterTypeConfig register a config for a provided type // RegisterTypeConfig register a config for a provided type
func RegisterTypeConfig(typ Type, exemplar Config) { func RegisterTypeConfig(typ Type, exemplar Config) {
if reflect.TypeOf(exemplar).Kind() == reflect.Ptr { if reflect.TypeOf(exemplar).Kind() == reflect.Pointer {
// Pointer: // Pointer:
registeredConfigs[typ] = func() Config { registeredConfigs[typ] = func() Config {
return reflect.New(reflect.ValueOf(exemplar).Elem().Type()).Interface().(Config) return reflect.New(reflect.ValueOf(exemplar).Elem().Type()).Interface().(Config)
+1 -1
View File
@@ -9,7 +9,7 @@ import (
) )
func fieldByName(v reflect.Value, field string) reflect.Value { func fieldByName(v reflect.Value, field string) reflect.Value {
if v.Kind() == reflect.Ptr { if v.Kind() == reflect.Pointer {
v = v.Elem() v = v.Elem()
} }
f := v.FieldByName(field) f := v.FieldByName(field)
+1 -1
View File
@@ -91,7 +91,7 @@ func (e *MarshalEncoder) marshal(v any) error {
val := reflect.ValueOf(v) val := reflect.ValueOf(v)
typ := reflect.TypeOf(v) typ := reflect.TypeOf(v)
if typ.Kind() == reflect.Ptr { if typ.Kind() == reflect.Pointer {
val = val.Elem() val = val.Elem()
typ = typ.Elem() typ = typ.Elem()
} }
+3 -2
View File
@@ -9,6 +9,7 @@ import (
"net" "net"
"net/http" "net/http"
"reflect" "reflect"
"slices"
"code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/web/routing" "code.gitea.io/gitea/modules/web/routing"
@@ -131,8 +132,8 @@ type middlewareProvider = func(next http.Handler) http.Handler
func executeMiddlewaresHandler(w http.ResponseWriter, r *http.Request, middlewares []middlewareProvider, endpoint http.HandlerFunc) { func executeMiddlewaresHandler(w http.ResponseWriter, r *http.Request, middlewares []middlewareProvider, endpoint http.HandlerFunc) {
handler := endpoint handler := endpoint
for i := len(middlewares) - 1; i >= 0; i-- { for _, middleware := range slices.Backward(middlewares) {
handler = middlewares[i](handler).ServeHTTP handler = middleware(handler).ServeHTTP
} }
handler(w, r) handler(w, r)
} }
+2 -2
View File
@@ -29,7 +29,7 @@ func AssignForm(form any, data map[string]any) {
typ := reflect.TypeOf(form) typ := reflect.TypeOf(form)
val := reflect.ValueOf(form) val := reflect.ValueOf(form)
for typ.Kind() == reflect.Ptr { for typ.Kind() == reflect.Pointer {
typ = typ.Elem() typ = typ.Elem()
val = val.Elem() val = val.Elem()
} }
@@ -104,7 +104,7 @@ func Validate(errs binding.Errors, data map[string]any, f Form, l translation.Lo
data["ErrorMsg"] = l.TrString("form.unknown_error") data["ErrorMsg"] = l.TrString("form.unknown_error")
typ := reflect.TypeOf(f) typ := reflect.TypeOf(f)
if typ.Kind() == reflect.Ptr { if typ.Kind() == reflect.Pointer {
typ = typ.Elem() typ = typ.Elem()
} }
+1 -1
View File
@@ -57,7 +57,7 @@ func (t *Task) IsEnabled() bool {
// GetConfig will return a copy of the task's config // GetConfig will return a copy of the task's config
func (t *Task) GetConfig() Config { func (t *Task) GetConfig() Config {
if reflect.TypeOf(t.config).Kind() == reflect.Ptr { if reflect.TypeOf(t.config).Kind() == reflect.Pointer {
// Pointer: // Pointer:
return reflect.New(reflect.ValueOf(t.config).Elem().Type()).Interface().(Config) return reflect.New(reflect.ValueOf(t.config).Elem().Type()).Interface().(Config)
} }
+2 -2
View File
@@ -6,6 +6,7 @@ package gitdiff
import ( import (
"bytes" "bytes"
"html/template" "html/template"
"slices"
"strings" "strings"
"unicode/utf8" "unicode/utf8"
@@ -385,8 +386,7 @@ func (hcd *highlightCodeDiff) recoverOneDiff(str string) template.HTML {
} }
// close all opening tags // close all opening tags
for i := len(tagStack) - 1; i >= 0; i-- { for _, tagToClose := range slices.Backward(tagStack) {
tagToClose := tagStack[i]
// get the closing tag "</span>" from "<span class=...>" or "<span>" // get the closing tag "</span>" from "<span class=...>" or "<span>"
pos := strings.IndexAny(tagToClose, " >") pos := strings.IndexAny(tagToClose, " >")
// pos must be positive, because the tags were pushed by us // pos must be positive, because the tags were pushed by us
+2 -3
View File
@@ -10,6 +10,7 @@ import (
"html" "html"
"net/url" "net/url"
"regexp" "regexp"
"slices"
"strconv" "strconv"
"strings" "strings"
"time" "time"
@@ -123,9 +124,7 @@ func getIssueFromRef(ctx context.Context, repo *repo_model.Repository, index int
// UpdateIssuesCommit checks if issues are manipulated by commit message. // UpdateIssuesCommit checks if issues are manipulated by commit message.
func UpdateIssuesCommit(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, commits []*repository.PushCommit, branchName string) error { func UpdateIssuesCommit(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, commits []*repository.PushCommit, branchName string) error {
// Commits are appended in the reverse order. // Commits are appended in the reverse order.
for i := len(commits) - 1; i >= 0; i-- { for _, c := range slices.Backward(commits) {
c := commits[i]
type markKey struct { type markKey struct {
ID int64 ID int64
Action references.XRefAction Action references.XRefAction
+2 -2
View File
@@ -9,6 +9,7 @@ import (
"fmt" "fmt"
"io" "io"
"regexp" "regexp"
"slices"
"strings" "strings"
"time" "time"
"unicode/utf8" "unicode/utf8"
@@ -845,8 +846,7 @@ func GetSquashMergeCommitMessages(ctx context.Context, pr *issues_model.PullRequ
// use PR's commit messages as squash commit message // use PR's commit messages as squash commit message
// commits list is in reverse chronological order // commits list is in reverse chronological order
maxMsgSize := setting.Repository.PullRequest.DefaultMergeMessageSize maxMsgSize := setting.Repository.PullRequest.DefaultMergeMessageSize
for i := len(commits) - 1; i >= 0; i-- { for _, commit := range slices.Backward(commits) {
commit := commits[i]
msg := strings.TrimSpace(commit.MessageUTF8()) msg := strings.TrimSpace(commit.MessageUTF8())
if msg == "" { if msg == "" {
continue continue
+2 -2
View File
@@ -6,6 +6,7 @@ package gitgraph
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"slices"
) )
// Parser represents a git graph parser. It is stateful containing the previous // Parser represents a git graph parser. It is stateful containing the previous
@@ -163,8 +164,7 @@ func (parser *Parser) ParseGlyphs(glyphs []byte) {
// release unused colors // release unused colors
parser.releaseUnusedColors() parser.releaseUnusedColors()
for i := len(glyphs) - 1; i >= 0; i-- { for i, glyph := range slices.Backward(glyphs) {
glyph := glyphs[i]
switch glyph { switch glyph {
case '|': case '|':
fallthrough fallthrough