From 0585ac3ac6ff4f59e8455cb5f4cbe42c4b79c965 Mon Sep 17 00:00:00 2001 From: silverwind Date: Thu, 8 Dec 2022 09:21:37 +0100 Subject: [PATCH] Update go dev dependencies (#22064) `golangci-lint` [deprecated](https://github.com/golangci/golangci-lint/issues/1841) a bunch of linters, removed them. --- .golangci.yml | 34 ++++++++++++++-------------- Makefile | 12 +++++----- models/db/context.go | 6 +++-- models/migrations/v1_17/main_test.go | 2 +- models/migrations/v1_17/v211.go | 2 +- models/migrations/v1_17/v212.go | 2 +- models/migrations/v1_17/v213.go | 2 +- models/migrations/v1_17/v214.go | 2 +- models/migrations/v1_17/v215.go | 2 +- models/migrations/v1_17/v216.go | 2 +- models/migrations/v1_17/v217.go | 2 +- models/migrations/v1_17/v218.go | 2 +- models/migrations/v1_17/v219.go | 2 +- models/migrations/v1_17/v220.go | 2 +- models/migrations/v1_17/v221.go | 2 +- models/migrations/v1_17/v221_test.go | 2 +- models/migrations/v1_17/v222.go | 2 +- models/migrations/v1_17/v223.go | 2 +- models/migrations/v1_18/main_test.go | 2 +- models/migrations/v1_18/v224.go | 2 +- models/migrations/v1_18/v225.go | 2 +- models/migrations/v1_18/v226.go | 2 +- models/migrations/v1_18/v227.go | 2 +- models/migrations/v1_18/v228.go | 2 +- models/migrations/v1_18/v230.go | 2 +- models/migrations/v1_19/main_test.go | 2 +- models/migrations/v1_19/v232.go | 2 +- models/migrations/v1_6/v70.go | 2 +- models/migrations/v1_6/v71.go | 2 +- models/migrations/v1_6/v72.go | 2 +- models/migrations/v1_7/v73.go | 2 +- models/migrations/v1_7/v74.go | 2 +- models/migrations/v1_7/v75.go | 2 +- models/migrations/v1_8/v76.go | 2 +- models/migrations/v1_8/v77.go | 2 +- models/migrations/v1_8/v78.go | 2 +- models/migrations/v1_8/v79.go | 2 +- models/migrations/v1_8/v80.go | 2 +- models/migrations/v1_8/v81.go | 2 +- models/migrations/v1_9/v82.go | 2 +- modules/charset/escape_stream.go | 2 +- modules/log/groutinelabel.go | 2 +- modules/setting/setting.go | 2 +- routers/api/packages/pypi/pypi.go | 6 +++-- 44 files changed, 71 insertions(+), 67 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 99133badd9b..130ad286b50 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,28 +1,28 @@ linters: enable: - - gosimple - - deadcode - - typecheck - - govet - - errcheck - - staticcheck - - unused - - structcheck - - varcheck + - bidichk + # - deadcode # deprecated - https://github.com/golangci/golangci-lint/issues/1841 + - depguard - dupl - #- gocyclo # The cyclomatic complexety of a lot of functions is too high, we should refactor those another time. - - gofmt + - errcheck - gocritic - - bidichk - - ineffassign - - revive + # - gocyclo # The cyclomatic complexety of a lot of functions is too high, we should refactor those another time. + - gofmt - gofumpt - - depguard + - gosimple + - govet + - ineffassign - nakedret - - unconvert - - wastedassign - nolintlint + - revive + - staticcheck + # - structcheck # deprecated - https://github.com/golangci/golangci-lint/issues/1841 - stylecheck + - typecheck + - unconvert + - unused + # - varcheck # deprecated - https://github.com/golangci/golangci-lint/issues/1841 + # - wastedassign # disabled - https://github.com/golangci/golangci-lint/issues/2649 enable-all: false disable-all: true fast: false diff --git a/Makefile b/Makefile index 4d78944de15..d1122984a7d 100644 --- a/Makefile +++ b/Makefile @@ -26,15 +26,15 @@ COMMA := , 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 +EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/cmd/editorconfig-checker@2.6.0 +ERRCHECK_PACKAGE ?= github.com/kisielk/errcheck@v1.6.2 +GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.4.0 +GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.50.1 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 +SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.30.3 XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest -GO_LICENSES_PACKAGE ?= github.com/google/go-licenses@v1.3.0 +GO_LICENSES_PACKAGE ?= github.com/google/go-licenses@v1.5.0 GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@latest DOCKER_IMAGE ?= gitea/gitea diff --git a/models/db/context.go b/models/db/context.go index fb95e94c931..c8ad0c1aa27 100644 --- a/models/db/context.go +++ b/models/db/context.go @@ -21,8 +21,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/models/migrations/v1_17/main_test.go b/models/migrations/v1_17/main_test.go index e6871cacf2e..79cb3fa0788 100644 --- a/models/migrations/v1_17/main_test.go +++ b/models/migrations/v1_17/main_test.go @@ -1,7 +1,7 @@ // Copyright 2021 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_17 // nolint +package v1_17 //nolint import ( "testing" diff --git a/models/migrations/v1_17/v211.go b/models/migrations/v1_17/v211.go index 227de4984fc..16ec5184936 100644 --- a/models/migrations/v1_17/v211.go +++ b/models/migrations/v1_17/v211.go @@ -1,7 +1,7 @@ // Copyright 2022 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_17 // nolint +package v1_17 //nolint import ( "fmt" diff --git a/models/migrations/v1_17/v212.go b/models/migrations/v1_17/v212.go index a00d29cd2fd..536ba0a2c42 100644 --- a/models/migrations/v1_17/v212.go +++ b/models/migrations/v1_17/v212.go @@ -1,7 +1,7 @@ // Copyright 2022 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_17 // nolint +package v1_17 //nolint import ( "code.gitea.io/gitea/modules/timeutil" diff --git a/models/migrations/v1_17/v213.go b/models/migrations/v1_17/v213.go index 2ed56104cf7..8607fdba47f 100644 --- a/models/migrations/v1_17/v213.go +++ b/models/migrations/v1_17/v213.go @@ -1,7 +1,7 @@ // Copyright 2022 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_17 // nolint +package v1_17 //nolint import ( "xorm.io/xorm" diff --git a/models/migrations/v1_17/v214.go b/models/migrations/v1_17/v214.go index e619b805a61..3b2351d1604 100644 --- a/models/migrations/v1_17/v214.go +++ b/models/migrations/v1_17/v214.go @@ -1,7 +1,7 @@ // Copyright 2022 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_17 // nolint +package v1_17 //nolint import ( "xorm.io/xorm" diff --git a/models/migrations/v1_17/v215.go b/models/migrations/v1_17/v215.go index 43e5b636c9b..0244be216c4 100644 --- a/models/migrations/v1_17/v215.go +++ b/models/migrations/v1_17/v215.go @@ -1,7 +1,7 @@ // Copyright 2022 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_17 // nolint +package v1_17 //nolint import ( "code.gitea.io/gitea/models/pull" diff --git a/models/migrations/v1_17/v216.go b/models/migrations/v1_17/v216.go index 388cb971e70..59b21d9b2c4 100644 --- a/models/migrations/v1_17/v216.go +++ b/models/migrations/v1_17/v216.go @@ -1,7 +1,7 @@ // Copyright 2022 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_17 // nolint +package v1_17 //nolint // This migration added non-ideal indices to the action table which on larger datasets slowed things down // it has been superceded by v218.go diff --git a/models/migrations/v1_17/v217.go b/models/migrations/v1_17/v217.go index bbb40251fbe..3ca9215f093 100644 --- a/models/migrations/v1_17/v217.go +++ b/models/migrations/v1_17/v217.go @@ -1,7 +1,7 @@ // Copyright 2022 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_17 // nolint +package v1_17 //nolint import ( "code.gitea.io/gitea/modules/setting" diff --git a/models/migrations/v1_17/v218.go b/models/migrations/v1_17/v218.go index 4d5e77070bb..675fd1df94f 100644 --- a/models/migrations/v1_17/v218.go +++ b/models/migrations/v1_17/v218.go @@ -1,7 +1,7 @@ // Copyright 2022 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_17 // nolint +package v1_17 //nolint import ( "code.gitea.io/gitea/modules/setting" diff --git a/models/migrations/v1_17/v219.go b/models/migrations/v1_17/v219.go index c8aa2378c30..a2165212cc9 100644 --- a/models/migrations/v1_17/v219.go +++ b/models/migrations/v1_17/v219.go @@ -1,7 +1,7 @@ // Copyright 2022 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_17 // nolint +package v1_17 //nolint import ( "time" diff --git a/models/migrations/v1_17/v220.go b/models/migrations/v1_17/v220.go index 31158509b87..904ddc51929 100644 --- a/models/migrations/v1_17/v220.go +++ b/models/migrations/v1_17/v220.go @@ -1,7 +1,7 @@ // Copyright 2022 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_17 // nolint +package v1_17 //nolint import ( packages_model "code.gitea.io/gitea/models/packages" diff --git a/models/migrations/v1_17/v221.go b/models/migrations/v1_17/v221.go index ceb079f369d..8a58b0f1056 100644 --- a/models/migrations/v1_17/v221.go +++ b/models/migrations/v1_17/v221.go @@ -1,7 +1,7 @@ // Copyright 2022 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_17 // nolint +package v1_17 //nolint import ( "encoding/base32" diff --git a/models/migrations/v1_17/v221_test.go b/models/migrations/v1_17/v221_test.go index 3215d74915f..9ca54142e2d 100644 --- a/models/migrations/v1_17/v221_test.go +++ b/models/migrations/v1_17/v221_test.go @@ -1,7 +1,7 @@ // Copyright 2022 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_17 // nolint +package v1_17 //nolint import ( "encoding/base32" diff --git a/models/migrations/v1_17/v222.go b/models/migrations/v1_17/v222.go index 558c0d9adcd..d1b77d845d1 100644 --- a/models/migrations/v1_17/v222.go +++ b/models/migrations/v1_17/v222.go @@ -1,7 +1,7 @@ // Copyright 2022 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_17 // nolint +package v1_17 //nolint import ( "context" diff --git a/models/migrations/v1_17/v223.go b/models/migrations/v1_17/v223.go index c83deb255fe..a23d9916b38 100644 --- a/models/migrations/v1_17/v223.go +++ b/models/migrations/v1_17/v223.go @@ -1,7 +1,7 @@ // Copyright 2022 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_17 // nolint +package v1_17 //nolint import ( "context" diff --git a/models/migrations/v1_18/main_test.go b/models/migrations/v1_18/main_test.go index aec48845bf7..f71a21d1fb2 100644 --- a/models/migrations/v1_18/main_test.go +++ b/models/migrations/v1_18/main_test.go @@ -1,7 +1,7 @@ // Copyright 2021 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_18 // nolint +package v1_18 //nolint import ( "testing" diff --git a/models/migrations/v1_18/v224.go b/models/migrations/v1_18/v224.go index f37b773effa..afd34a5db09 100644 --- a/models/migrations/v1_18/v224.go +++ b/models/migrations/v1_18/v224.go @@ -1,7 +1,7 @@ // Copyright 2022 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_18 // nolint +package v1_18 //nolint import ( "xorm.io/xorm" diff --git a/models/migrations/v1_18/v225.go b/models/migrations/v1_18/v225.go index 2ff5f4c7f7c..786772c143b 100644 --- a/models/migrations/v1_18/v225.go +++ b/models/migrations/v1_18/v225.go @@ -1,7 +1,7 @@ // Copyright 2022 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_18 // nolint +package v1_18 //nolint import ( "code.gitea.io/gitea/modules/setting" diff --git a/models/migrations/v1_18/v226.go b/models/migrations/v1_18/v226.go index 536346a97a6..f87e24b11de 100644 --- a/models/migrations/v1_18/v226.go +++ b/models/migrations/v1_18/v226.go @@ -1,7 +1,7 @@ // Copyright 2022 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_18 // nolint +package v1_18 //nolint import ( "xorm.io/builder" diff --git a/models/migrations/v1_18/v227.go b/models/migrations/v1_18/v227.go index b4da88ee0ae..c938028323f 100644 --- a/models/migrations/v1_18/v227.go +++ b/models/migrations/v1_18/v227.go @@ -1,7 +1,7 @@ // Copyright 2022 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_18 // nolint +package v1_18 //nolint import ( "fmt" diff --git a/models/migrations/v1_18/v228.go b/models/migrations/v1_18/v228.go index 3144310507f..58d3257528a 100644 --- a/models/migrations/v1_18/v228.go +++ b/models/migrations/v1_18/v228.go @@ -1,7 +1,7 @@ // Copyright 2022 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_18 // nolint +package v1_18 //nolint import ( "code.gitea.io/gitea/modules/timeutil" diff --git a/models/migrations/v1_18/v230.go b/models/migrations/v1_18/v230.go index 2d2248fcb38..cf94926be17 100644 --- a/models/migrations/v1_18/v230.go +++ b/models/migrations/v1_18/v230.go @@ -1,7 +1,7 @@ // Copyright 2022 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_18 // nolint +package v1_18 //nolint import ( "xorm.io/xorm" diff --git a/models/migrations/v1_19/main_test.go b/models/migrations/v1_19/main_test.go index 3d08ec2f5e9..59f42af1116 100644 --- a/models/migrations/v1_19/main_test.go +++ b/models/migrations/v1_19/main_test.go @@ -1,7 +1,7 @@ // Copyright 2021 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_19 // nolint +package v1_19 //nolint import ( "testing" diff --git a/models/migrations/v1_19/v232.go b/models/migrations/v1_19/v232.go index 9feb5343bcd..89b595c5437 100644 --- a/models/migrations/v1_19/v232.go +++ b/models/migrations/v1_19/v232.go @@ -1,7 +1,7 @@ // Copyright 2022 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_19 // nolint +package v1_19 //nolint import ( "code.gitea.io/gitea/modules/setting" diff --git a/models/migrations/v1_6/v70.go b/models/migrations/v1_6/v70.go index 166772ad700..fec88266ba6 100644 --- a/models/migrations/v1_6/v70.go +++ b/models/migrations/v1_6/v70.go @@ -1,7 +1,7 @@ // Copyright 2018 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_6 // nolint +package v1_6 //nolint import ( "fmt" diff --git a/models/migrations/v1_6/v71.go b/models/migrations/v1_6/v71.go index 57586c5c326..effd2ebf995 100644 --- a/models/migrations/v1_6/v71.go +++ b/models/migrations/v1_6/v71.go @@ -1,7 +1,7 @@ // Copyright 2018 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_6 // nolint +package v1_6 //nolint import ( "fmt" diff --git a/models/migrations/v1_6/v72.go b/models/migrations/v1_6/v72.go index b7428150bef..ce963eb3714 100644 --- a/models/migrations/v1_6/v72.go +++ b/models/migrations/v1_6/v72.go @@ -1,7 +1,7 @@ // Copyright 2018 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_6 // nolint +package v1_6 //nolint import ( "fmt" diff --git a/models/migrations/v1_7/v73.go b/models/migrations/v1_7/v73.go index 0c5775c2b2d..1013daedbd6 100644 --- a/models/migrations/v1_7/v73.go +++ b/models/migrations/v1_7/v73.go @@ -1,7 +1,7 @@ // Copyright 2018 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_7 // nolint +package v1_7 //nolint import ( "xorm.io/xorm" diff --git a/models/migrations/v1_7/v74.go b/models/migrations/v1_7/v74.go index aeca5448e10..bdd89d1f342 100644 --- a/models/migrations/v1_7/v74.go +++ b/models/migrations/v1_7/v74.go @@ -1,7 +1,7 @@ // Copyright 2018 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_7 // nolint +package v1_7 //nolint import "xorm.io/xorm" diff --git a/models/migrations/v1_7/v75.go b/models/migrations/v1_7/v75.go index bad8010090a..fa7430970c9 100644 --- a/models/migrations/v1_7/v75.go +++ b/models/migrations/v1_7/v75.go @@ -1,7 +1,7 @@ // Copyright 2018 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_7 // nolint +package v1_7 //nolint import ( "xorm.io/builder" diff --git a/models/migrations/v1_8/v76.go b/models/migrations/v1_8/v76.go index 45126893860..f35856cc606 100644 --- a/models/migrations/v1_8/v76.go +++ b/models/migrations/v1_8/v76.go @@ -1,7 +1,7 @@ // Copyright 2018 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_8 // nolint +package v1_8 //nolint import ( "fmt" diff --git a/models/migrations/v1_8/v77.go b/models/migrations/v1_8/v77.go index f92dfed882d..2305984c129 100644 --- a/models/migrations/v1_8/v77.go +++ b/models/migrations/v1_8/v77.go @@ -1,7 +1,7 @@ // Copyright 2019 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_8 // nolint +package v1_8 //nolint import ( "xorm.io/xorm" diff --git a/models/migrations/v1_8/v78.go b/models/migrations/v1_8/v78.go index 8bc0221412e..637db451f5b 100644 --- a/models/migrations/v1_8/v78.go +++ b/models/migrations/v1_8/v78.go @@ -1,7 +1,7 @@ // Copyright 2019 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_8 // nolint +package v1_8 //nolint import ( "code.gitea.io/gitea/models/migrations/base" diff --git a/models/migrations/v1_8/v79.go b/models/migrations/v1_8/v79.go index 9cebca18537..e708d722946 100644 --- a/models/migrations/v1_8/v79.go +++ b/models/migrations/v1_8/v79.go @@ -1,7 +1,7 @@ // Copyright 2019 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_8 // nolint +package v1_8 //nolint import ( "code.gitea.io/gitea/modules/setting" diff --git a/models/migrations/v1_8/v80.go b/models/migrations/v1_8/v80.go index ec9726d8892..7f2e0ff72bf 100644 --- a/models/migrations/v1_8/v80.go +++ b/models/migrations/v1_8/v80.go @@ -1,7 +1,7 @@ // Copyright 2019 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_8 // nolint +package v1_8 //nolint import "xorm.io/xorm" diff --git a/models/migrations/v1_8/v81.go b/models/migrations/v1_8/v81.go index ff050386b43..a100dc1ef71 100644 --- a/models/migrations/v1_8/v81.go +++ b/models/migrations/v1_8/v81.go @@ -1,7 +1,7 @@ // Copyright 2019 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_8 // nolint +package v1_8 //nolint import ( "fmt" diff --git a/models/migrations/v1_9/v82.go b/models/migrations/v1_9/v82.go index b0dffe6035f..26806dd6450 100644 --- a/models/migrations/v1_9/v82.go +++ b/models/migrations/v1_9/v82.go @@ -1,7 +1,7 @@ // Copyright 2019 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -package v1_9 // nolint +package v1_9 //nolint import ( "fmt" diff --git a/modules/charset/escape_stream.go b/modules/charset/escape_stream.go index d29e393ab4d..823b635137e 100644 --- a/modules/charset/escape_stream.go +++ b/modules/charset/escape_stream.go @@ -239,7 +239,7 @@ func (counts runeCountType) needsEscape() bool { type runeType int const ( - basicASCIIRuneType runeType = iota //nolint // <- This is technically deadcode but its self-documenting so it should stay + basicASCIIRuneType runeType = iota // <- This is technically deadcode but its self-documenting so it should stay brokenRuneType nonBasicASCIIRuneType ambiguousRuneType diff --git a/modules/log/groutinelabel.go b/modules/log/groutinelabel.go index 829c217574e..56d7af42da3 100644 --- a/modules/log/groutinelabel.go +++ b/modules/log/groutinelabel.go @@ -6,7 +6,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 f0d7f029271..9f2f0933d4e 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -941,7 +941,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 6cf9329bbb1..609c63dc64f 100644 --- a/routers/api/packages/pypi/pypi.go +++ b/routers/api/packages/pypi/pypi.go @@ -21,8 +21,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?` +