summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2023-02-08 03:28:25 +0800
committerGitHub <noreply@github.com>2023-02-07 19:28:25 +0000
commitff2014690dc9a17b73836f9d8af5184aa0134770 (patch)
treefdd849247cf8dfb207bd334a692c12c4eef3d17a
parent03c644c48c511037d293bea6b4333338a932a0fc (diff)
downloadgitea-ff2014690dc9a17b73836f9d8af5184aa0134770.tar.gz
gitea-ff2014690dc9a17b73836f9d8af5184aa0134770.zip
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>
-rw-r--r--.golangci.yml3
-rw-r--r--Makefile4
-rw-r--r--go.mod1
-rw-r--r--go.sum3
-rw-r--r--models/db/context.go6
-rw-r--r--modules/log/groutinelabel.go2
-rw-r--r--modules/setting/setting.go2
-rw-r--r--routers/api/packages/pypi/pypi.go6
8 files changed, 18 insertions, 9 deletions
diff --git a/.golangci.yml b/.golangci.yml
index 99133badd9..d252b20235 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -173,3 +173,6 @@ issues:
linters:
- revive
text: "exported: type name will be used as user.UserBadge by other packages, and that stutters; consider calling this Badge"
+ - path: models/db/sql_postgres_with_schema.go
+ linters:
+ - nolintlint
diff --git a/Makefile b/Makefile
index 20510bbec6..a900eb1ac8 100644
--- a/Makefile
+++ b/Makefile
@@ -28,8 +28,8 @@ XGO_VERSION := go-1.19.x
AIR_PACKAGE ?= github.com/cosmtrek/air@v1.40.4
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/cmd/editorconfig-checker@2.5.0
ERRCHECK_PACKAGE ?= github.com/kisielk/errcheck@v1.6.1
-GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.3.1
-GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.47.0
+GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.4.0
+GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.0
GXZ_PAGAGE ?= github.com/ulikunitz/xz/cmd/gxz@v0.5.10
MISSPELL_PACKAGE ?= github.com/client9/misspell/cmd/misspell@v0.3.4
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.30.0
diff --git a/go.mod b/go.mod
index fa78018b55..689444205e 100644
--- a/go.mod
+++ b/go.mod
@@ -285,6 +285,7 @@ require (
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.23.0 // indirect
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
+ golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde // indirect
golang.org/x/time v0.0.0-20220922220347-f3bd1da661af // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220616135557-88e70c0c3a90 // indirect
diff --git a/go.sum b/go.sum
index 09a1a13fd7..89c0997739 100644
--- a/go.sum
+++ b/go.sum
@@ -1759,7 +1759,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw=
+golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde h1:ejfdSekXMDxDLbRrJMwUk6KnSLZ2McaUCVcIKM+N6jc=
+golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
diff --git a/models/db/context.go b/models/db/context.go
index 4fd35200cf..0d8d0a5bc4 100644
--- a/models/db/context.go
+++ b/models/db/context.go
@@ -24,8 +24,10 @@ type contextKey struct {
}
// enginedContextKey is a context key. It is used with context.Value() to get the current Engined for the context
-var enginedContextKey = &contextKey{"engined"}
-var _ Engined = &Context{}
+var (
+ enginedContextKey = &contextKey{"engined"}
+ _ Engined = &Context{}
+)
// Context represents a db context
type Context struct {
diff --git a/modules/log/groutinelabel.go b/modules/log/groutinelabel.go
index 0d3739fd98..c83880f4de 100644
--- a/modules/log/groutinelabel.go
+++ b/modules/log/groutinelabel.go
@@ -7,7 +7,7 @@ package log
import "unsafe"
//go:linkname runtime_getProfLabel runtime/pprof.runtime_getProfLabel
-func runtime_getProfLabel() unsafe.Pointer // nolint
+func runtime_getProfLabel() unsafe.Pointer //nolint
type labelMap map[string]string
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index 1eefa188c2..26a55c913b 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -944,7 +944,7 @@ func loadFromConf(allowEmpty bool, extraConfig string) {
if SecretKey == "" {
// FIXME: https://github.com/go-gitea/gitea/issues/16832
// Until it supports rotating an existing secret key, we shouldn't move users off of the widely used default value
- SecretKey = "!#@FDEWREWR&*(" // nolint:gosec
+ SecretKey = "!#@FDEWREWR&*(" //nolint:gosec
}
CookieRememberName = sec.Key("COOKIE_REMEMBER_NAME").MustString("gitea_incredible")
diff --git a/routers/api/packages/pypi/pypi.go b/routers/api/packages/pypi/pypi.go
index 2063fc37ce..e6cc21799a 100644
--- a/routers/api/packages/pypi/pypi.go
+++ b/routers/api/packages/pypi/pypi.go
@@ -22,8 +22,10 @@ import (
)
// https://peps.python.org/pep-0426/#name
-var normalizer = strings.NewReplacer(".", "-", "_", "-")
-var nameMatcher = regexp.MustCompile(`\A(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\.\-_]*[a-zA-Z0-9])\z`)
+var (
+ normalizer = strings.NewReplacer(".", "-", "_", "-")
+ nameMatcher = regexp.MustCompile(`\A(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\.\-_]*[a-zA-Z0-9])\z`)
+)
// https://peps.python.org/pep-0440/#appendix-b-parsing-version-strings-with-regular-expressions
var versionMatcher = regexp.MustCompile(`\Av?` +