Skip to content

Commit 850012b

Browse files
authored
Update golangci-lint to v2.6.0 (#35801)
https://github.com/golangci/golangci-lint/releases/tag/v2.6.0 - `modernize` linter is enabled, this is the same as `gopls modernize` - ~~`perfsprint` linter is disabled because it conflicts with `modernize` (maybe there is a middle ground)~~ - gocritic `deprecatedComment` is disabled as it conflicts with `go-swagger`
1 parent bb1f523 commit 850012b

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

.golangci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ linters:
1414
- govet
1515
- ineffassign
1616
- mirror
17+
- modernize
1718
- nakedret
1819
- nolintlint
1920
- perfsprint
@@ -55,6 +56,7 @@ linters:
5556
disabled-checks:
5657
- ifElseChain
5758
- singleCaseSwitch # Every time this occurred in the code, there was no other way.
59+
- deprecatedComment # conflicts with go-swagger comments
5860
revive:
5961
severity: error
6062
rules:
@@ -107,6 +109,11 @@ linters:
107109
- require-error
108110
usetesting:
109111
os-temp-dir: true
112+
modernize:
113+
disable:
114+
- stringsbuilder
115+
perfsprint:
116+
concat-loop: false
110117
exclusions:
111118
generated: lax
112119
presets:

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ XGO_VERSION := go-1.25.x
3232
AIR_PACKAGE ?= github.com/air-verse/air@v1
3333
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/v3/cmd/editorconfig-checker@v3
3434
GOFUMPT_PACKAGE ?= mvdan.cc/[email protected]
35-
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.5.0
35+
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.6.0
3636
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/[email protected]
3737
MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/[email protected]
3838
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/[email protected]

models/user/user.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,8 +1262,8 @@ func GetUserByEmail(ctx context.Context, email string) (*User, error) {
12621262
}
12631263

12641264
// Finally, if email address is the protected email address:
1265-
if strings.HasSuffix(email, "@"+setting.Service.NoReplyAddress) {
1266-
username := strings.TrimSuffix(email, "@"+setting.Service.NoReplyAddress)
1265+
if before, ok := strings.CutSuffix(email, "@"+setting.Service.NoReplyAddress); ok {
1266+
username := before
12671267
user := &User{}
12681268
has, err := db.GetEngine(ctx).Where("lower_name=?", username).Get(user)
12691269
if err != nil {

services/wiki/wiki_path.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ func GitPathToWebPath(s string) (wp WebPath, err error) {
129129
func WebPathToUserTitle(s WebPath) (dir, display string) {
130130
dir = path.Dir(string(s))
131131
display = path.Base(string(s))
132-
if strings.HasSuffix(display, ".md") {
133-
display = strings.TrimSuffix(display, ".md")
132+
if before, ok := strings.CutSuffix(display, ".md"); ok {
133+
display = before
134134
display, _ = url.PathUnescape(display)
135135
}
136136
display, _ = unescapeSegment(display)

0 commit comments

Comments
 (0)