chore(deps): update golangci-lint (#1833)

This commit is contained in:
Alessandro (Ale) Segala
2026-10-11 12:14:16 +02:00
committed by GitHub
parent 89827f076f
commit 7cc3a128c5
12 changed files with 34 additions and 22 deletions
+1 -2
View File
@@ -133,10 +133,9 @@ jobs:
- name: Run Golangci-lint
uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0
with:
version: v2.13.2
version-file: .golangci-lint-version
args: --config=.golangci.yml
working-directory: backend
only-new-issues: ${{ github.event_name == 'pull_request' }}
backend-test:
name: Backend tests (${{ matrix.name }})
+7 -2
View File
@@ -6,6 +6,11 @@
"editor.defaultFormatter": "oxc.oxc-vscode"
},
"[go]": {
"editor.defaultFormatter": "golang.go"
"editor.defaultFormatter": "golang.go",
"editor.formatOnSave": true
},
"[go.mod]": {
"editor.defaultFormatter": "golang.go",
"editor.formatOnSave": true
}
}
}
+1
View File
@@ -0,0 +1 @@
v2.14.0
+3 -1
View File
@@ -19,9 +19,9 @@ linters:
- errchkjson
- errorlint
- exhaustive
- exptostd
- gocheckcompilerdirectives
- gochecksumtype
- gocognit
- gocritic
- gosec
- gosmopolitan
@@ -30,9 +30,11 @@ linters:
- loggercheck
- makezero
- musttag
- nakedret
- nilerr
- nilnesserr
- noctx
- perfsprint
- protogetter
- reassign
- recvcheck
+2 -2
View File
@@ -79,7 +79,7 @@ func UnsupportedFileType(expected string) *Error {
}
func FileTooLarge(maxSize string) *Error {
return New(CodeFileTooLarge, http.StatusRequestEntityTooLarge, fmt.Sprintf("File must not exceed %s", maxSize)).WithDetail("max_size", maxSize)
return New(CodeFileTooLarge, http.StatusRequestEntityTooLarge, "File must not exceed "+maxSize).WithDetail("max_size", maxSize)
}
func NotSignedIn() *Error {
@@ -281,7 +281,7 @@ func LogoTypeNotSupported() *Error {
}
func LogoTooLarge(maxSize string) *Error {
return New(CodeLogoTooLarge, http.StatusUnprocessableEntity, fmt.Sprintf("Downloaded logo must not exceed %s", maxSize)).
return New(CodeLogoTooLarge, http.StatusUnprocessableEntity, "Downloaded logo must not exceed "+maxSize).
WithDetail("max_size", maxSize)
}
+2 -3
View File
@@ -1,7 +1,6 @@
package email
import (
"fmt"
"time"
)
@@ -10,7 +9,7 @@ import (
var newLoginTemplate = template[newLoginTemplateData]{
path: "login-with-new-device",
title: func(data *templateData[newLoginTemplateData]) string {
return fmt.Sprintf("New device login with %s", data.AppName)
return "New device login with " + data.AppName
},
}
@@ -31,7 +30,7 @@ var testTemplate = template[struct{}]{
var apiKeyExpiringSoonTemplate = template[apiKeyExpiringSoonTemplateData]{
path: "api-key-expiring-soon",
title: func(data *templateData[apiKeyExpiringSoonTemplateData]) string {
return fmt.Sprintf("API Key \"%s\" Expiring Soon", data.Data.ApiKeyName)
return `API Key "` + data.Data.ApiKeyName + `" Expiring Soon`
},
}
@@ -2,6 +2,7 @@ package emailverification
import (
"context"
"errors"
"fmt"
"log/slog"
"time"
@@ -97,7 +98,7 @@ func (s *Service) Verify(ctx context.Context, userID, token string) error {
var result consumeResponse
if response == nil {
return fmt.Errorf("email verification actor returned an empty response")
return errors.New("email verification actor returned an empty response")
}
err = response.Decode(&result)
if err != nil {
+2 -2
View File
@@ -759,12 +759,12 @@ func (s *Service) saveProfilePicture(parentCtx context.Context, userId string, p
const maxProfilePictureSize int64 = 2 * 1024 * 1024 // 2MB
if res.ContentLength > maxProfilePictureSize {
return fmt.Errorf("profile picture must not exceed 2 MB")
return errors.New("profile picture must not exceed 2 MB")
}
data, err := io.ReadAll(utils.NewLimitReader(res.Body, maxProfilePictureSize+1))
if errors.Is(err, utils.ErrSizeExceeded) {
return fmt.Errorf("profile picture must not exceed 2 MB")
return errors.New("profile picture must not exceed 2 MB")
} else if err != nil {
return fmt.Errorf("failed to read profile picture: %w", err)
}
+2 -2
View File
@@ -3,10 +3,10 @@ package middleware
import (
"context"
"errors"
"fmt"
"log/slog"
"net/http"
"reflect"
"strconv"
"strings"
"time"
"unicode"
@@ -254,7 +254,7 @@ func formatRetryAfter(retryAfter time.Duration) string {
seconds = 1
}
return fmt.Sprintf("%d", seconds)
return strconv.Itoa(seconds)
}
func capitalizeFirst(message string) string {
+10 -5
View File
@@ -476,7 +476,7 @@ func (s *Service) syncGroups(ctx context.Context, provider ServiceProvider, grou
func (s *Service) syncUser(ctx context.Context, provider ServiceProvider, user model.User, userResource *ScimUser) (scimSyncAction, *ScimUser, error) {
// If user is not allowed for the client, delete it from SCIM provider
if userResource != nil && !oidc.IsUserGroupAllowedToAuthorize(user, provider.OidcClient) {
return scimActionDeleted, nil, s.deleteScimResource(ctx, provider, fmt.Sprintf("/Users/%s", url.PathEscape(userResource.ID)))
return scimActionDeleted, nil, s.deleteScimResource(ctx, provider, "/Users/"+url.PathEscape(userResource.ID))
}
payload := ScimUser{
@@ -505,11 +505,13 @@ func (s *Service) syncUser(ctx context.Context, provider ServiceProvider, user m
if user.LastModified().Before(userResource.GetMeta().LastModified) {
return scimActionNone, nil, nil
}
path := fmt.Sprintf("/Users/%s", url.PathEscape(userResource.GetID()))
path := "/Users/" + url.PathEscape(userResource.GetID())
userResource, err := updateScimResource(s, ctx, provider, path, payload)
if err != nil {
return scimActionNone, nil, err
}
return scimActionUpdated, userResource, nil
}
@@ -525,10 +527,11 @@ func (s *Service) syncUser(ctx context.Context, provider ServiceProvider, user m
func (s *Service) syncGroup(ctx context.Context, provider ServiceProvider, group model.UserGroup, groupResource *ScimGroup, userResources []ScimUser) (scimSyncAction, error) {
// If group is not allowed for the client, delete it from SCIM provider
if groupResource != nil && !groupAllowedForClient(group.ID, provider.OidcClient) {
err := s.deleteScimResource(ctx, provider, fmt.Sprintf("/Groups/%s", url.PathEscape(groupResource.GetID())))
err := s.deleteScimResource(ctx, provider, "/Groups/"+url.PathEscape(groupResource.GetID()))
if err != nil {
return scimActionNone, err
}
return scimActionDeleted, nil
}
@@ -560,11 +563,13 @@ func (s *Service) syncGroup(ctx context.Context, provider ServiceProvider, group
if group.LastModified().Before(groupResource.GetMeta().LastModified) {
return scimActionNone, nil
}
path := fmt.Sprintf("/Groups/%s", url.PathEscape(groupResource.GetID()))
path := "/Groups/" + url.PathEscape(groupResource.GetID())
_, err := updateScimResource(s, ctx, provider, path, groupPayload)
if err != nil {
return scimActionNone, err
}
return scimActionUpdated, nil
}
@@ -826,7 +831,7 @@ func (s *Service) scimRequest(ctx context.Context, provider ServiceProvider, met
}
}
return nil, fmt.Errorf("scim request retry attempts exceeded")
return nil, errors.New("scim request retry attempts exceeded")
}
func scimRetryDelay(retryAfter string, attempt int) time.Duration {
+1 -1
View File
@@ -414,7 +414,7 @@ func (m *mockSCIMTransport) RoundTrip(req *http.Request) (*http.Response, error)
func (m *mockSCIMTransport) validateRequest(req *http.Request, body []byte) string {
if req.URL.Scheme != "https" || req.URL.Host != "scim.example.test" {
return fmt.Sprintf("request used unexpected SCIM endpoint %s", req.URL.String())
return "request used unexpected SCIM endpoint " + req.URL.String()
}
if req.Header.Get("Accept") != mockSCIMRequestContentType {
return "request did not accept application/scim+json"
+1 -1
View File
@@ -965,7 +965,7 @@ func (s *OidcService) downloadAndSaveLogoFromURL(parentCtx context.Context, clie
return apperror.InvalidLogoURL(err)
}
if (u.Scheme != "http" && u.Scheme != "https") || u.Host == "" {
return apperror.InvalidLogoURL(fmt.Errorf("URL must use HTTP or HTTPS and include a host"))
return apperror.InvalidLogoURL(errors.New("URL must use HTTP or HTTPS and include a host"))
}
ctx, cancel := context.WithTimeout(parentCtx, 15*time.Second)