Update go dev dependencies (#22064)

`golangci-lint`
[deprecated](https://github.com/golangci/golangci-lint/issues/1841) a
bunch of linters, removed them.
This commit is contained in:
silverwind 2022-12-08 09:21:37 +01:00 committed by GitHub
parent cf27403e18
commit 0585ac3ac6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
44 changed files with 72 additions and 68 deletions

View file

@ -1,28 +1,28 @@
linters: linters:
enable: enable:
- gosimple
- deadcode
- typecheck
- govet
- errcheck
- staticcheck
- unused
- structcheck
- varcheck
- dupl
#- gocyclo # The cyclomatic complexety of a lot of functions is too high, we should refactor those another time.
- gofmt
- gocritic
- bidichk - bidichk
- ineffassign # - deadcode # deprecated - https://github.com/golangci/golangci-lint/issues/1841
- revive
- gofumpt
- depguard - depguard
- dupl
- errcheck
- gocritic
# - gocyclo # The cyclomatic complexety of a lot of functions is too high, we should refactor those another time.
- gofmt
- gofumpt
- gosimple
- govet
- ineffassign
- nakedret - nakedret
- unconvert
- wastedassign
- nolintlint - nolintlint
- revive
- staticcheck
# - structcheck # deprecated - https://github.com/golangci/golangci-lint/issues/1841
- stylecheck - 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 enable-all: false
disable-all: true disable-all: true
fast: false fast: false

View file

@ -26,15 +26,15 @@ COMMA := ,
XGO_VERSION := go-1.19.x XGO_VERSION := go-1.19.x
AIR_PACKAGE ?= github.com/cosmtrek/air@v1.40.4 AIR_PACKAGE ?= github.com/cosmtrek/air@v1.40.4
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/cmd/editorconfig-checker@2.5.0 EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/cmd/editorconfig-checker@2.6.0
ERRCHECK_PACKAGE ?= github.com/kisielk/errcheck@v1.6.1 ERRCHECK_PACKAGE ?= github.com/kisielk/errcheck@v1.6.2
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.3.1 GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.4.0
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.47.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 GXZ_PAGAGE ?= github.com/ulikunitz/xz/cmd/gxz@v0.5.10
MISSPELL_PACKAGE ?= github.com/client9/misspell/cmd/misspell@v0.3.4 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 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 GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@latest
DOCKER_IMAGE ?= gitea/gitea DOCKER_IMAGE ?= gitea/gitea

View file

@ -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 // enginedContextKey is a context key. It is used with context.Value() to get the current Engined for the context
var enginedContextKey = &contextKey{"engined"} var (
var _ Engined = &Context{} enginedContextKey = &contextKey{"engined"}
_ Engined = &Context{}
)
// Context represents a db context // Context represents a db context
type Context struct { type Context struct {

View file

@ -1,7 +1,7 @@
// Copyright 2021 The Gitea Authors. All rights reserved. // Copyright 2021 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_17 // nolint package v1_17 //nolint
import ( import (
"testing" "testing"

View file

@ -1,7 +1,7 @@
// Copyright 2022 The Gitea Authors. All rights reserved. // Copyright 2022 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_17 // nolint package v1_17 //nolint
import ( import (
"fmt" "fmt"

View file

@ -1,7 +1,7 @@
// Copyright 2022 The Gitea Authors. All rights reserved. // Copyright 2022 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_17 // nolint package v1_17 //nolint
import ( import (
"code.gitea.io/gitea/modules/timeutil" "code.gitea.io/gitea/modules/timeutil"

View file

@ -1,7 +1,7 @@
// Copyright 2022 The Gitea Authors. All rights reserved. // Copyright 2022 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_17 // nolint package v1_17 //nolint
import ( import (
"xorm.io/xorm" "xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2022 The Gitea Authors. All rights reserved. // Copyright 2022 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_17 // nolint package v1_17 //nolint
import ( import (
"xorm.io/xorm" "xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2022 The Gitea Authors. All rights reserved. // Copyright 2022 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_17 // nolint package v1_17 //nolint
import ( import (
"code.gitea.io/gitea/models/pull" "code.gitea.io/gitea/models/pull"

View file

@ -1,7 +1,7 @@
// Copyright 2022 The Gitea Authors. All rights reserved. // Copyright 2022 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // 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 // This migration added non-ideal indices to the action table which on larger datasets slowed things down
// it has been superceded by v218.go // it has been superceded by v218.go

View file

@ -1,7 +1,7 @@
// Copyright 2022 The Gitea Authors. All rights reserved. // Copyright 2022 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_17 // nolint package v1_17 //nolint
import ( import (
"code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/setting"

View file

@ -1,7 +1,7 @@
// Copyright 2022 The Gitea Authors. All rights reserved. // Copyright 2022 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_17 // nolint package v1_17 //nolint
import ( import (
"code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/setting"

View file

@ -1,7 +1,7 @@
// Copyright 2022 The Gitea Authors. All rights reserved. // Copyright 2022 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_17 // nolint package v1_17 //nolint
import ( import (
"time" "time"

View file

@ -1,7 +1,7 @@
// Copyright 2022 The Gitea Authors. All rights reserved. // Copyright 2022 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_17 // nolint package v1_17 //nolint
import ( import (
packages_model "code.gitea.io/gitea/models/packages" packages_model "code.gitea.io/gitea/models/packages"

View file

@ -1,7 +1,7 @@
// Copyright 2022 The Gitea Authors. All rights reserved. // Copyright 2022 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_17 // nolint package v1_17 //nolint
import ( import (
"encoding/base32" "encoding/base32"

View file

@ -1,7 +1,7 @@
// Copyright 2022 The Gitea Authors. All rights reserved. // Copyright 2022 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_17 // nolint package v1_17 //nolint
import ( import (
"encoding/base32" "encoding/base32"

View file

@ -1,7 +1,7 @@
// Copyright 2022 The Gitea Authors. All rights reserved. // Copyright 2022 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_17 // nolint package v1_17 //nolint
import ( import (
"context" "context"

View file

@ -1,7 +1,7 @@
// Copyright 2022 The Gitea Authors. All rights reserved. // Copyright 2022 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_17 // nolint package v1_17 //nolint
import ( import (
"context" "context"

View file

@ -1,7 +1,7 @@
// Copyright 2021 The Gitea Authors. All rights reserved. // Copyright 2021 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_18 // nolint package v1_18 //nolint
import ( import (
"testing" "testing"

View file

@ -1,7 +1,7 @@
// Copyright 2022 The Gitea Authors. All rights reserved. // Copyright 2022 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_18 // nolint package v1_18 //nolint
import ( import (
"xorm.io/xorm" "xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2022 The Gitea Authors. All rights reserved. // Copyright 2022 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_18 // nolint package v1_18 //nolint
import ( import (
"code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/setting"

View file

@ -1,7 +1,7 @@
// Copyright 2022 The Gitea Authors. All rights reserved. // Copyright 2022 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_18 // nolint package v1_18 //nolint
import ( import (
"xorm.io/builder" "xorm.io/builder"

View file

@ -1,7 +1,7 @@
// Copyright 2022 The Gitea Authors. All rights reserved. // Copyright 2022 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_18 // nolint package v1_18 //nolint
import ( import (
"fmt" "fmt"

View file

@ -1,7 +1,7 @@
// Copyright 2022 The Gitea Authors. All rights reserved. // Copyright 2022 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_18 // nolint package v1_18 //nolint
import ( import (
"code.gitea.io/gitea/modules/timeutil" "code.gitea.io/gitea/modules/timeutil"

View file

@ -1,7 +1,7 @@
// Copyright 2022 The Gitea Authors. All rights reserved. // Copyright 2022 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_18 // nolint package v1_18 //nolint
import ( import (
"xorm.io/xorm" "xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2021 The Gitea Authors. All rights reserved. // Copyright 2021 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_19 // nolint package v1_19 //nolint
import ( import (
"testing" "testing"

View file

@ -1,7 +1,7 @@
// Copyright 2022 The Gitea Authors. All rights reserved. // Copyright 2022 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_19 // nolint package v1_19 //nolint
import ( import (
"code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/setting"

View file

@ -1,7 +1,7 @@
// Copyright 2018 The Gitea Authors. All rights reserved. // Copyright 2018 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_6 // nolint package v1_6 //nolint
import ( import (
"fmt" "fmt"

View file

@ -1,7 +1,7 @@
// Copyright 2018 The Gitea Authors. All rights reserved. // Copyright 2018 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_6 // nolint package v1_6 //nolint
import ( import (
"fmt" "fmt"

View file

@ -1,7 +1,7 @@
// Copyright 2018 The Gitea Authors. All rights reserved. // Copyright 2018 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_6 // nolint package v1_6 //nolint
import ( import (
"fmt" "fmt"

View file

@ -1,7 +1,7 @@
// Copyright 2018 The Gitea Authors. All rights reserved. // Copyright 2018 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_7 // nolint package v1_7 //nolint
import ( import (
"xorm.io/xorm" "xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2018 The Gitea Authors. All rights reserved. // Copyright 2018 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_7 // nolint package v1_7 //nolint
import "xorm.io/xorm" import "xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2018 The Gitea Authors. All rights reserved. // Copyright 2018 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_7 // nolint package v1_7 //nolint
import ( import (
"xorm.io/builder" "xorm.io/builder"

View file

@ -1,7 +1,7 @@
// Copyright 2018 The Gitea Authors. All rights reserved. // Copyright 2018 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_8 // nolint package v1_8 //nolint
import ( import (
"fmt" "fmt"

View file

@ -1,7 +1,7 @@
// Copyright 2019 The Gitea Authors. All rights reserved. // Copyright 2019 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_8 // nolint package v1_8 //nolint
import ( import (
"xorm.io/xorm" "xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2019 The Gitea Authors. All rights reserved. // Copyright 2019 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_8 // nolint package v1_8 //nolint
import ( import (
"code.gitea.io/gitea/models/migrations/base" "code.gitea.io/gitea/models/migrations/base"

View file

@ -1,7 +1,7 @@
// Copyright 2019 The Gitea Authors. All rights reserved. // Copyright 2019 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_8 // nolint package v1_8 //nolint
import ( import (
"code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/setting"

View file

@ -1,7 +1,7 @@
// Copyright 2019 The Gitea Authors. All rights reserved. // Copyright 2019 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_8 // nolint package v1_8 //nolint
import "xorm.io/xorm" import "xorm.io/xorm"

View file

@ -1,7 +1,7 @@
// Copyright 2019 The Gitea Authors. All rights reserved. // Copyright 2019 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_8 // nolint package v1_8 //nolint
import ( import (
"fmt" "fmt"

View file

@ -1,7 +1,7 @@
// Copyright 2019 The Gitea Authors. All rights reserved. // Copyright 2019 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package v1_9 // nolint package v1_9 //nolint
import ( import (
"fmt" "fmt"

View file

@ -239,7 +239,7 @@ func (counts runeCountType) needsEscape() bool {
type runeType int type runeType int
const ( 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 brokenRuneType
nonBasicASCIIRuneType nonBasicASCIIRuneType
ambiguousRuneType ambiguousRuneType

View file

@ -6,7 +6,7 @@ package log
import "unsafe" import "unsafe"
//go:linkname runtime_getProfLabel runtime/pprof.runtime_getProfLabel //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 type labelMap map[string]string

View file

@ -941,7 +941,7 @@ func loadFromConf(allowEmpty bool, extraConfig string) {
if SecretKey == "" { if SecretKey == "" {
// FIXME: https://github.com/go-gitea/gitea/issues/16832 // 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 // 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") CookieRememberName = sec.Key("COOKIE_REMEMBER_NAME").MustString("gitea_incredible")

View file

@ -21,8 +21,10 @@ import (
) )
// https://peps.python.org/pep-0426/#name // https://peps.python.org/pep-0426/#name
var normalizer = strings.NewReplacer(".", "-", "_", "-") var (
var nameMatcher = regexp.MustCompile(`\A(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\.\-_]*[a-zA-Z0-9])\z`) 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 // https://peps.python.org/pep-0440/#appendix-b-parsing-version-strings-with-regular-expressions
var versionMatcher = regexp.MustCompile(`\Av?` + var versionMatcher = regexp.MustCompile(`\Av?` +