Skip to content

Commit ff20146

Browse files
upgrade golangcilint to v1.51.0 (#22764)
With the upgrade to go 1.20 golangci-lint no longer correctly works. We must therefore upgrade to the latest golangci-lint. Co-authored-by: techknowlogick <techknowlogick@gitea.io>
1 parent 03c644c commit ff20146

File tree

8 files changed

+18
-9
lines changed

8 files changed

+18
-9
lines changed

.golangci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,6 @@ issues:
173173
linters:
174174
- revive
175175
text: "exported: type name will be used as user.UserBadge by other packages, and that stutters; consider calling this Badge"
176+
- path: models/db/sql_postgres_with_schema.go
177+
linters:
178+
- nolintlint

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ XGO_VERSION := go-1.19.x
2828
AIR_PACKAGE ?= github.com/cosmtrek/air@v1.40.4
2929
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/cmd/editorconfig-checker@2.5.0
3030
ERRCHECK_PACKAGE ?= github.com/kisielk/errcheck@v1.6.1
31-
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.3.1
32-
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.47.0
31+
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.4.0
32+
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.0
3333
GXZ_PAGAGE ?= github.com/ulikunitz/xz/cmd/gxz@v0.5.10
3434
MISSPELL_PACKAGE ?= github.com/client9/misspell/cmd/misspell@v0.3.4
3535
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.30.0

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ require (
285285
go.uber.org/multierr v1.8.0 // indirect
286286
go.uber.org/zap v1.23.0 // indirect
287287
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
288+
golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde // indirect
288289
golang.org/x/time v0.0.0-20220922220347-f3bd1da661af // indirect
289290
google.golang.org/appengine v1.6.7 // indirect
290291
google.golang.org/genproto v0.0.0-20220616135557-88e70c0c3a90 // indirect

go.sum

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1759,7 +1759,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ
17591759
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
17601760
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
17611761
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
1762-
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw=
1762+
golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde h1:ejfdSekXMDxDLbRrJMwUk6KnSLZ2McaUCVcIKM+N6jc=
1763+
golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
17631764
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
17641765
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
17651766
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=

models/db/context.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ type contextKey struct {
2424
}
2525

2626
// enginedContextKey is a context key. It is used with context.Value() to get the current Engined for the context
27-
var enginedContextKey = &contextKey{"engined"}
28-
var _ Engined = &Context{}
27+
var (
28+
enginedContextKey = &contextKey{"engined"}
29+
_ Engined = &Context{}
30+
)
2931

3032
// Context represents a db context
3133
type Context struct {

modules/log/groutinelabel.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ package log
77
import "unsafe"
88

99
//go:linkname runtime_getProfLabel runtime/pprof.runtime_getProfLabel
10-
func runtime_getProfLabel() unsafe.Pointer // nolint
10+
func runtime_getProfLabel() unsafe.Pointer //nolint
1111

1212
type labelMap map[string]string
1313

modules/setting/setting.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,7 @@ func loadFromConf(allowEmpty bool, extraConfig string) {
944944
if SecretKey == "" {
945945
// FIXME: https://github.com/go-gitea/gitea/issues/16832
946946
// Until it supports rotating an existing secret key, we shouldn't move users off of the widely used default value
947-
SecretKey = "!#@FDEWREWR&*(" // nolint:gosec
947+
SecretKey = "!#@FDEWREWR&*(" //nolint:gosec
948948
}
949949

950950
CookieRememberName = sec.Key("COOKIE_REMEMBER_NAME").MustString("gitea_incredible")

routers/api/packages/pypi/pypi.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ import (
2222
)
2323

2424
// https://peps.python.org/pep-0426/#name
25-
var normalizer = strings.NewReplacer(".", "-", "_", "-")
26-
var nameMatcher = regexp.MustCompile(`\A(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\.\-_]*[a-zA-Z0-9])\z`)
25+
var (
26+
normalizer = strings.NewReplacer(".", "-", "_", "-")
27+
nameMatcher = regexp.MustCompile(`\A(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\.\-_]*[a-zA-Z0-9])\z`)
28+
)
2729

2830
// https://peps.python.org/pep-0440/#appendix-b-parsing-version-strings-with-regular-expressions
2931
var versionMatcher = regexp.MustCompile(`\Av?` +

0 commit comments

Comments
 (0)