chore: update golangci-lint to v2.13.0

Migrate the deprecated gofumpt `extra-rules` to `extra.group-params`, as
the alias now also enables the new `clothe-returns` and `balance-calls`
rules. Disable SA4023, which hangs on go 1.27, see
https://github.com/golangci/golangci-lint/issues/6732.

Apply the resulting modernize fixes, mostly flattening embedded struct
literals and switching errors.As to errors.AsType.

Assisted-by: Claude:Opus 5
This commit is contained in:
silverwind
2026-08-20 06:21:34 +02:00
parent b227ad8a5f
commit bef127f188
173 changed files with 1161 additions and 1659 deletions
+2 -4
View File
@@ -10,6 +10,7 @@ import (
"fmt"
"io"
"net/http"
"uuid"
"gitea.dev/models/db"
repo_model "gitea.dev/models/repo"
@@ -17,8 +18,6 @@ import (
"gitea.dev/modules/storage"
"gitea.dev/modules/util"
"gitea.dev/services/context/upload"
"uuid"
)
// NewAttachment creates a new attachment object, but do not verify.
@@ -85,8 +84,7 @@ func uploadAttachment(ctx context.Context, file *UploaderFile, allowedTypes stri
}
attach, err := NewAttachment(ctx, attach, io.MultiReader(bytes.NewReader(buf), src), file.size)
var maxBytesError *http.MaxBytesError
if errors.As(err, &maxBytesError) {
if _, ok := errors.AsType[*http.MaxBytesError](err); ok {
return nil, util.ErrorWrap(util.ErrContentTooLarge, "attachment exceeds limit %d", maxFileSize)
}
return attach, err