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
@@ -333,10 +333,8 @@ func buildPackagesIndex(ctx context.Context, ownerID int64, repoVersion *package
ctx,
repoVersion,
&packages_service.PackageFileCreationInfo{
PackageFileInfo: packages_service.PackageFileInfo{
Filename: IndexArchiveFilename,
CompositeKey: fmt.Sprintf("%s|%s|%s", branch, repository, architecture),
},
Filename: IndexArchiveFilename,
CompositeKey: fmt.Sprintf("%s|%s|%s", branch, repository, architecture),
Creator: user_model.NewGhostUser(),
Data: signedIndexContent,
IsLead: false,
+2 -4
View File
@@ -328,10 +328,8 @@ func buildPackagesIndex(ctx context.Context, ownerID int64, repoVersion *package
ctx,
repoVersion,
&packages_service.PackageFileCreationInfo{
PackageFileInfo: packages_service.PackageFileInfo{
Filename: IndexArchiveFilename,
CompositeKey: fmt.Sprintf("%s|%s", repository, architecture),
},
Filename: IndexArchiveFilename,
CompositeKey: fmt.Sprintf("%s|%s", repository, architecture),
Creator: user_model.NewGhostUser(),
Data: indexContent,
IsLead: false,
+5 -9
View File
@@ -33,15 +33,11 @@ func CreateAuthorizationToken(u *user_model.User, packageScope auth_model.Access
actionsUserTaskID, _ := user_model.GetActionsUserTaskID(u)
claims := packageClaims{
RegisteredClaims: jwt.RegisteredClaims{
ExpiresAt: jwt.NewNumericDate(now.Add(24 * time.Hour)),
NotBefore: jwt.NewNumericDate(now),
},
PackageMeta: PackageMeta{
UserID: u.ID,
Scope: packageScope,
ActionsUserTaskID: actionsUserTaskID,
},
ExpiresAt: jwt.NewNumericDate(now.Add(24 * time.Hour)),
NotBefore: jwt.NewNumericDate(now),
UserID: u.ID,
Scope: packageScope,
ActionsUserTaskID: actionsUserTaskID,
}
token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)
+4 -8
View File
@@ -248,10 +248,8 @@ func buildPackagesIndices(ctx context.Context, ownerID int64, repoVersion *packa
ctx,
repoVersion,
&packages_service.PackageFileCreationInfo{
PackageFileInfo: packages_service.PackageFileInfo{
Filename: file.Name,
CompositeKey: fmt.Sprintf("%s|%s|%s", distribution, component, architecture),
},
Filename: file.Name,
CompositeKey: fmt.Sprintf("%s|%s|%s", distribution, component, architecture),
Creator: user_model.NewGhostUser(),
Data: file.Data,
IsLead: false,
@@ -400,10 +398,8 @@ func buildReleaseFiles(ctx context.Context, ownerID int64, repoVersion *packages
ctx,
repoVersion,
&packages_service.PackageFileCreationInfo{
PackageFileInfo: packages_service.PackageFileInfo{
Filename: file.Name,
CompositeKey: distribution,
},
Filename: file.Name,
CompositeKey: distribution,
Creator: user_model.NewGhostUser(),
Data: file.Data,
IsLead: false,
+4 -8
View File
@@ -317,10 +317,8 @@ func buildRepomd(ctx context.Context, pv *packages_model.PackageVersion, ownerID
ctx,
pv,
&packages_service.PackageFileCreationInfo{
PackageFileInfo: packages_service.PackageFileInfo{
Filename: file.Name,
CompositeKey: group,
},
Filename: file.Name,
CompositeKey: group,
Creator: user_model.NewGhostUser(),
Data: file.Data,
IsLead: false,
@@ -700,10 +698,8 @@ func addDataAsFileToRepo(ctx context.Context, pv *packages_model.PackageVersion,
ctx,
pv,
&packages_service.PackageFileCreationInfo{
PackageFileInfo: packages_service.PackageFileInfo{
Filename: filename,
CompositeKey: group,
},
Filename: filename,
CompositeKey: group,
Creator: user_model.NewGhostUser(),
Data: content,
IsLead: false,