aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/golangci
diff options
context:
space:
mode:
authordependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2024-03-04 17:40:11 +0000
committerTaras Madan <tarasmadan@google.com>2024-03-04 18:34:55 +0000
commit5fc5366972c874b919f93165bb4ed4e2bcb7c350 (patch)
tree287c3361a0dee0c72af80d9a1a66714a06e98a62 /vendor/github.com/golangci
parent1be5ce38a9059c356eb193a8c34d60d61c9fc31f (diff)
mod: bump github.com/golangci/golangci-lint from 1.55.2 to 1.56.2
Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.55.2 to 1.56.2. - [Release notes](https://github.com/golangci/golangci-lint/releases) - [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md) - [Commits](https://github.com/golangci/golangci-lint/compare/v1.55.2...v1.56.2) --- updated-dependencies: - dependency-name: github.com/golangci/golangci-lint dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
Diffstat (limited to 'vendor/github.com/golangci')
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/commands/config.go16
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/commands/executor.go3
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/commands/linters.go37
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/commands/root.go5
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/commands/run.go119
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/commands/version.go2
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/config/config.go4
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/config/issues.go8
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/config/linters_settings.go93
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/config/reader.go20
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/config/run.go2
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/fsutils/fsutils.go8
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/asciicheck.go8
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/bidichk.go2
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/cyclop.go4
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/depguard.go5
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/errchkjson.go6
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/errname.go8
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/exhaustive.go1
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner.go11
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go11
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/gochecksumtype.go2
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/goconst.go1
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/gocritic.go19
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/golint.go2
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/goprintffuncname.go8
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/govet.go41
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/grouper.go2
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/ifshort.go8
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/inamedparam.go15
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/ineffassign.go6
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/ireturn.go5
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/lll.go7
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/mirror.go2
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/misspell.go36
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/musttag.go2
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/nakedret.go10
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/noctx.go8
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/nolintlint.go2
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/nolintlint/nolintlint.go28
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/paralleltest.go4
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/perfsprint.go18
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/protogetter.go21
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/revive.go13
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/rowserrcheck.go8
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/sloglint.go4
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/spancheck.go29
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/sqlclosecheck.go10
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/stylecheck.go2
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/testifylint.go10
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/thelper.go10
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/tparallel.go7
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/unused.go2
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/varcheck.go2
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/wastedassign.go8
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/whitespace.go88
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/wrapcheck.go4
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/wsl.go94
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/golinters/zerologlint.go8
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/lint/linter/config.go4
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/lint/lintersdb/custom_linters.go15
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/lint/lintersdb/enabled_set.go12
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/lint/lintersdb/manager.go43
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/lint/runner.go8
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/packages/errors.go2
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/printers/checkstyle.go6
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/printers/github.go2
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/printers/junitxml.go6
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/result/processors/diff.go4
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/result/processors/nolint.go7
-rw-r--r--vendor/github.com/golangci/golangci-lint/pkg/result/processors/skip_files.go2
71 files changed, 576 insertions, 454 deletions
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/commands/config.go b/vendor/github.com/golangci/golangci-lint/pkg/commands/config.go
index a16ef6310..45c4fcd77 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/commands/config.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/commands/config.go
@@ -5,8 +5,10 @@ import (
"os"
"github.com/spf13/cobra"
+ "github.com/spf13/pflag"
"github.com/spf13/viper"
+ "github.com/golangci/golangci-lint/pkg/config"
"github.com/golangci/golangci-lint/pkg/exitcodes"
"github.com/golangci/golangci-lint/pkg/fsutils"
)
@@ -14,7 +16,7 @@ import (
func (e *Executor) initConfig() {
cmd := &cobra.Command{
Use: "config",
- Short: "Config",
+ Short: "Config file information",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, _ []string) error {
return cmd.Help()
@@ -29,7 +31,12 @@ func (e *Executor) initConfig() {
ValidArgsFunction: cobra.NoFileCompletions,
Run: e.executePathCmd,
}
- e.initRunConfiguration(pathCmd) // allow --config
+
+ fs := pathCmd.Flags()
+ fs.SortFlags = false // sort them as they are defined here
+
+ initConfigFileFlagSet(fs, &e.cfg.Run)
+
cmd.AddCommand(pathCmd)
}
@@ -59,3 +66,8 @@ func (e *Executor) executePathCmd(_ *cobra.Command, _ []string) {
fmt.Println(usedConfigFile)
}
+
+func initConfigFileFlagSet(fs *pflag.FlagSet, cfg *config.Run) {
+ fs.StringVarP(&cfg.Config, "config", "c", "", wh("Read config from file path `PATH`"))
+ fs.BoolVar(&cfg.NoConfig, "no-config", false, wh("Don't read config file"))
+}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/commands/executor.go b/vendor/github.com/golangci/golangci-lint/pkg/commands/executor.go
index 61e221cb8..d241f5656 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/commands/executor.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/commands/executor.go
@@ -4,6 +4,7 @@ import (
"bytes"
"context"
"crypto/sha256"
+ "errors"
"fmt"
"io"
"os"
@@ -78,7 +79,7 @@ func NewExecutor(buildInfo BuildInfo) *Executor {
// to setup log level early we need to parse config from command line extra time to
// find `-v` option
commandLineCfg, err := e.getConfigForCommandLine()
- if err != nil && err != pflag.ErrHelp {
+ if err != nil && !errors.Is(err, pflag.ErrHelp) {
e.log.Fatalf("Can't get config for command line: %s", err)
}
if commandLineCfg != nil {
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/commands/linters.go b/vendor/github.com/golangci/golangci-lint/pkg/commands/linters.go
index 292713ec9..69df21154 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/commands/linters.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/commands/linters.go
@@ -2,10 +2,13 @@ package commands
import (
"fmt"
+ "strings"
"github.com/fatih/color"
"github.com/spf13/cobra"
+ "github.com/spf13/pflag"
+ "github.com/golangci/golangci-lint/pkg/config"
"github.com/golangci/golangci-lint/pkg/lint/linter"
)
@@ -17,8 +20,25 @@ func (e *Executor) initLinters() {
ValidArgsFunction: cobra.NoFileCompletions,
RunE: e.executeLinters,
}
+
+ fs := e.lintersCmd.Flags()
+ fs.SortFlags = false // sort them as they are defined here
+
+ initConfigFileFlagSet(fs, &e.cfg.Run)
+ e.initLintersFlagSet(fs, &e.cfg.Linters)
+
e.rootCmd.AddCommand(e.lintersCmd)
- e.initRunConfiguration(e.lintersCmd)
+}
+
+func (e *Executor) initLintersFlagSet(fs *pflag.FlagSet, cfg *config.Linters) {
+ fs.StringSliceVarP(&cfg.Disable, "disable", "D", nil, wh("Disable specific linter"))
+ fs.BoolVar(&cfg.DisableAll, "disable-all", false, wh("Disable all linters"))
+ fs.StringSliceVarP(&cfg.Enable, "enable", "E", nil, wh("Enable specific linter"))
+ fs.BoolVar(&cfg.EnableAll, "enable-all", false, wh("Enable all linters"))
+ fs.BoolVar(&cfg.Fast, "fast", false, wh("Enable only fast linters from enabled linters set (first run won't be fast)"))
+ fs.StringSliceVarP(&cfg.Presets, "presets", "p", nil,
+ wh(fmt.Sprintf("Enable presets (%s) of linters. Run 'golangci-lint help linters' to see "+
+ "them. This option implies option --disable-all", strings.Join(e.DBManager.AllPresets(), "|"))))
}
// executeLinters runs the 'linters' CLI command, which displays the supported linters.
@@ -28,18 +48,9 @@ func (e *Executor) executeLinters(_ *cobra.Command, _ []string) error {
return fmt.Errorf("can't get enabled linters: %w", err)
}
- color.Green("Enabled by your configuration linters:\n")
var enabledLinters []*linter.Config
- for _, lc := range enabledLintersMap {
- if lc.Internal {
- continue
- }
-
- enabledLinters = append(enabledLinters, lc)
- }
- printLinterConfigs(enabledLinters)
-
var disabledLCs []*linter.Config
+
for _, lc := range e.DBManager.GetAllSupportedLinterConfigs() {
if lc.Internal {
continue
@@ -47,9 +58,13 @@ func (e *Executor) executeLinters(_ *cobra.Command, _ []string) error {
if enabledLintersMap[lc.Name()] == nil {
disabledLCs = append(disabledLCs, lc)
+ } else {
+ enabledLinters = append(enabledLinters, lc)
}
}
+ color.Green("Enabled by your configuration linters:\n")
+ printLinterConfigs(enabledLinters)
color.Red("\nDisabled by your configuration linters:\n")
printLinterConfigs(disabledLCs)
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/commands/root.go b/vendor/github.com/golangci/golangci-lint/pkg/commands/root.go
index efe62ced2..4425be10f 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/commands/root.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/commands/root.go
@@ -119,7 +119,7 @@ func formatMemory(memBytes uint64) string {
func getDefaultConcurrency() int {
if os.Getenv(envHelpRun) == "1" {
- // Make stable concurrency for README help generating builds.
+ // Make stable concurrency for generating help documentation.
const prettyConcurrency = 8
return prettyConcurrency
}
@@ -165,7 +165,8 @@ func initRootFlagSet(fs *pflag.FlagSet, cfg *config.Config, needVersionOption bo
fs.StringVar(&cfg.Run.CPUProfilePath, "cpu-profile-path", "", wh("Path to CPU profile output file"))
fs.StringVar(&cfg.Run.MemProfilePath, "mem-profile-path", "", wh("Path to memory profile output file"))
fs.StringVar(&cfg.Run.TracePath, "trace-path", "", wh("Path to trace output file"))
- fs.IntVarP(&cfg.Run.Concurrency, "concurrency", "j", getDefaultConcurrency(), wh("Concurrency (default NumCPU)"))
+ fs.IntVarP(&cfg.Run.Concurrency, "concurrency", "j", getDefaultConcurrency(),
+ wh("Number of CPUs to use (Default: number of logical CPUs)"))
if needVersionOption {
fs.BoolVar(&cfg.Run.PrintVersion, "version", false, wh("Print version"))
}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/commands/run.go b/vendor/github.com/golangci/golangci-lint/pkg/commands/run.go
index 9149b177b..5c7083c30 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/commands/run.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/commands/run.go
@@ -8,12 +8,14 @@ import (
"log"
"os"
"runtime"
+ "sort"
"strings"
"time"
"github.com/fatih/color"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
+ "golang.org/x/exp/maps"
"github.com/golangci/golangci-lint/pkg/config"
"github.com/golangci/golangci-lint/pkg/exitcodes"
@@ -27,6 +29,8 @@ import (
const defaultFileMode = 0644
+const defaultTimeout = time.Minute
+
const (
// envFailOnWarnings value: "1"
envFailOnWarnings = "FAIL_ON_WARNINGS"
@@ -34,35 +38,8 @@ const (
envMemLogEvery = "GL_MEM_LOG_EVERY"
)
-func getDefaultIssueExcludeHelp() string {
- parts := []string{"Use or not use default excludes:"}
- for _, ep := range config.DefaultExcludePatterns {
- parts = append(parts,
- fmt.Sprintf(" # %s %s: %s", ep.ID, ep.Linter, ep.Why),
- fmt.Sprintf(" - %s", color.YellowString(ep.Pattern)),
- "",
- )
- }
- return strings.Join(parts, "\n")
-}
-
-func getDefaultDirectoryExcludeHelp() string {
- parts := []string{"Use or not use default excluded directories:"}
- for _, dir := range packages.StdExcludeDirRegexps {
- parts = append(parts, fmt.Sprintf(" - %s", color.YellowString(dir)))
- }
- parts = append(parts, "")
- return strings.Join(parts, "\n")
-}
-
-func wh(text string) string {
- return color.GreenString(text)
-}
-
-const defaultTimeout = time.Minute
-
//nolint:funlen,gomnd
-func initFlagSet(fs *pflag.FlagSet, cfg *config.Config, m *lintersdb.Manager, isFinalInit bool) {
+func (e *Executor) initFlagSet(fs *pflag.FlagSet, cfg *config.Config, isFinalInit bool) {
hideFlag := func(name string) {
if err := fs.MarkHidden(name); err != nil {
panic(err)
@@ -77,6 +54,10 @@ func initFlagSet(fs *pflag.FlagSet, cfg *config.Config, m *lintersdb.Manager, is
}
}
+ // Config file config
+ rc := &cfg.Run
+ initConfigFileFlagSet(fs, rc)
+
// Output config
oc := &cfg.Output
fs.StringVar(&oc.Format, "out-format",
@@ -96,9 +77,8 @@ func initFlagSet(fs *pflag.FlagSet, cfg *config.Config, m *lintersdb.Manager, is
}
// Run config
- rc := &cfg.Run
fs.StringVar(&rc.ModulesDownloadMode, "modules-download-mode", "",
- "Modules download mode. If not empty, passed as -mod=<mode> to go tools")
+ wh("Modules download mode. If not empty, passed as -mod=<mode> to go tools"))
fs.IntVar(&rc.ExitCodeIfIssuesFound, "issues-exit-code",
exitcodes.IssuesFound, wh("Exit code when issues were found"))
fs.StringVar(&rc.Go, "go", "", wh("Targeted Go version"))
@@ -113,8 +93,6 @@ func initFlagSet(fs *pflag.FlagSet, cfg *config.Config, m *lintersdb.Manager, is
fs.BoolVar(&rc.AnalyzeTests, "tests", true, wh("Analyze tests (*_test.go)"))
fs.BoolVar(&rc.PrintResourcesUsage, "print-resources-usage", false,
wh("Print avg and max memory usage of golangci-lint and total time"))
- fs.StringVarP(&rc.Config, "config", "c", "", wh("Read config from file path `PATH`"))
- fs.BoolVar(&rc.NoConfig, "no-config", false, wh("Don't read config"))
fs.StringSliceVar(&rc.SkipDirs, "skip-dirs", nil, wh("Regexps of directories to skip"))
fs.BoolVar(&rc.UseDefaultSkipDirs, "skip-dirs-use-default", true, getDefaultDirectoryExcludeHelp())
fs.StringSliceVar(&rc.SkipFiles, "skip-files", nil, wh("Regexps of files to skip"))
@@ -122,9 +100,10 @@ func initFlagSet(fs *pflag.FlagSet, cfg *config.Config, m *lintersdb.Manager, is
const allowParallelDesc = "Allow multiple parallel golangci-lint instances running. " +
"If false (default) - golangci-lint acquires file lock on start."
fs.BoolVar(&rc.AllowParallelRunners, "allow-parallel-runners", false, wh(allowParallelDesc))
- const allowSerialDesc = "Allow multiple golangci-lint instances running, but serialize them around a lock. " +
+ const allowSerialDesc = "Allow multiple golangci-lint instances running, but serialize them around a lock. " +
"If false (default) - golangci-lint exits with an error if it fails to acquire file lock on start."
fs.BoolVar(&rc.AllowSerialRunners, "allow-serial-runners", false, wh(allowSerialDesc))
+ fs.BoolVar(&rc.ShowStats, "show-stats", false, wh("Show statistics per linter"))
// Linters settings config
lsc := &cfg.LintersSettings
@@ -197,15 +176,7 @@ func initFlagSet(fs *pflag.FlagSet, cfg *config.Config, m *lintersdb.Manager, is
// Linters config
lc := &cfg.Linters
- fs.StringSliceVarP(&lc.Enable, "enable", "E", nil, wh("Enable specific linter"))
- fs.StringSliceVarP(&lc.Disable, "disable", "D", nil, wh("Disable specific linter"))
- fs.BoolVar(&lc.EnableAll, "enable-all", false, wh("Enable all linters"))
-
- fs.BoolVar(&lc.DisableAll, "disable-all", false, wh("Disable all linters"))
- fs.StringSliceVarP(&lc.Presets, "presets", "p", nil,
- wh(fmt.Sprintf("Enable presets (%s) of linters. Run 'golangci-lint linters' to see "+
- "them. This option implies option --disable-all", strings.Join(m.AllPresets(), "|"))))
- fs.BoolVar(&lc.Fast, "fast", false, wh("Run only fast linters from enabled linters set (first run won't be fast)"))
+ e.initLintersFlagSet(fs, lc)
// Issues config
ic := &cfg.Issues
@@ -232,13 +203,13 @@ func initFlagSet(fs *pflag.FlagSet, cfg *config.Config, m *lintersdb.Manager, is
wh("Show only new issues created in git patch with file path `PATH`"))
fs.BoolVar(&ic.WholeFiles, "whole-files", false,
wh("Show issues in any part of update files (requires new-from-rev or new-from-patch)"))
- fs.BoolVar(&ic.NeedFix, "fix", false, "Fix found issues (if it's supported by the linter)")
+ fs.BoolVar(&ic.NeedFix, "fix", false, wh("Fix found issues (if it's supported by the linter)"))
}
func (e *Executor) initRunConfiguration(cmd *cobra.Command) {
fs := cmd.Flags()
fs.SortFlags = false // sort them as they are defined here
- initFlagSet(fs, e.cfg, e.DBManager, true)
+ e.initFlagSet(fs, e.cfg, true)
}
func (e *Executor) getConfigForCommandLine() (*config.Config, error) {
@@ -251,7 +222,7 @@ func (e *Executor) getConfigForCommandLine() (*config.Config, error) {
// `changed` variable inside string slice vars will be shared.
// Use another config variable here, not e.cfg, to not
// affect main parsing by this parsing of only config option.
- initFlagSet(fs, &cfg, e.DBManager, false)
+ e.initFlagSet(fs, &cfg, false)
initVersionFlagSet(fs, &cfg)
// Parse max options, even force version option: don't want
@@ -261,11 +232,11 @@ func (e *Executor) getConfigForCommandLine() (*config.Config, error) {
fs.Usage = func() {} // otherwise, help text will be printed twice
if err := fs.Parse(os.Args); err != nil {
- if err == pflag.ErrHelp {
+ if errors.Is(err, pflag.ErrHelp) {
return nil, err
}
- return nil, fmt.Errorf("can't parse args: %s", err)
+ return nil, fmt.Errorf("can't parse args: %w", err)
}
return &cfg, nil
@@ -408,6 +379,8 @@ func (e *Executor) runAndPrint(ctx context.Context, args []string) error {
}
}
+ e.printStats(issues)
+
e.setExitCodeIfIssuesFound(issues)
e.fileCache.PrintStats(e.log)
@@ -433,7 +406,7 @@ func (e *Executor) printReports(issues []result.Issue, path, format string) erro
if file, ok := w.(io.Closer); shouldClose && ok {
_ = file.Close()
}
- return fmt.Errorf("can't print %d issues: %s", len(issues), err)
+ return fmt.Errorf("can't print %d issues: %w", len(issues), err)
}
if file, ok := w.(io.Closer); shouldClose && ok {
@@ -489,6 +462,31 @@ func (e *Executor) createPrinter(format string, w io.Writer) (printers.Printer,
return p, nil
}
+func (e *Executor) printStats(issues []result.Issue) {
+ if !e.cfg.Run.ShowStats {
+ return
+ }
+
+ if len(issues) == 0 {
+ e.runCmd.Println("0 issues.")
+ return
+ }
+
+ stats := map[string]int{}
+ for idx := range issues {
+ stats[issues[idx].FromLinter]++
+ }
+
+ e.runCmd.Printf("%d issues:\n", len(issues))
+
+ keys := maps.Keys(stats)
+ sort.Strings(keys)
+
+ for _, key := range keys {
+ e.runCmd.Printf("* %s: %d\n", key, stats[key])
+ }
+}
+
// executeRun executes the 'run' CLI command, which runs the linters.
func (e *Executor) executeRun(_ *cobra.Command, args []string) {
needTrackResources := e.cfg.Run.IsVerbose || e.cfg.Run.PrintResourcesUsage
@@ -609,3 +607,28 @@ func watchResources(ctx context.Context, done chan struct{}, logger logutils.Log
logger.Infof("Execution took %s", time.Since(startedAt))
close(done)
}
+
+func getDefaultIssueExcludeHelp() string {
+ parts := []string{color.GreenString("Use or not use default excludes:")}
+ for _, ep := range config.DefaultExcludePatterns {
+ parts = append(parts,
+ fmt.Sprintf(" # %s %s: %s", ep.ID, ep.Linter, ep.Why),
+ fmt.Sprintf(" - %s", color.YellowString(ep.Pattern)),
+ "",
+ )
+ }
+ return strings.Join(parts, "\n")
+}
+
+func getDefaultDirectoryExcludeHelp() string {
+ parts := []string{color.GreenString("Use or not use default excluded directories:")}
+ for _, dir := range packages.StdExcludeDirRegexps {
+ parts = append(parts, fmt.Sprintf(" - %s", color.YellowString(dir)))
+ }
+ parts = append(parts, "")
+ return strings.Join(parts, "\n")
+}
+
+func wh(text string) string {
+ return color.GreenString(text)
+}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/commands/version.go b/vendor/github.com/golangci/golangci-lint/pkg/commands/version.go
index bb7732250..10ab7c1bb 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/commands/version.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/commands/version.go
@@ -38,7 +38,7 @@ func (e *Executor) initVersion() {
Short: "Version",
Args: cobra.NoArgs,
ValidArgsFunction: cobra.NoFileCompletions,
- RunE: func(cmd *cobra.Command, _ []string) error {
+ RunE: func(_ *cobra.Command, _ []string) error {
if e.cfg.Version.Debug {
info, ok := debug.ReadBuildInfo()
if !ok {
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/config/config.go b/vendor/github.com/golangci/golangci-lint/pkg/config/config.go
index 7941f428f..a5483a20e 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/config/config.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/config/config.go
@@ -41,13 +41,13 @@ type Version struct {
Debug bool `mapstructure:"debug"`
}
-func IsGreaterThanOrEqualGo121(v string) bool {
+func IsGreaterThanOrEqualGo122(v string) bool {
v1, err := hcversion.NewVersion(strings.TrimPrefix(v, "go"))
if err != nil {
return false
}
- limit, err := hcversion.NewVersion("1.21")
+ limit, err := hcversion.NewVersion("1.22")
if err != nil {
return false
}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/config/issues.go b/vendor/github.com/golangci/golangci-lint/pkg/config/issues.go
index 5968d83d5..27dcf8105 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/config/issues.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/config/issues.go
@@ -139,16 +139,16 @@ type BaseRule struct {
func (b *BaseRule) Validate(minConditionsCount int) error {
if err := validateOptionalRegex(b.Path); err != nil {
- return fmt.Errorf("invalid path regex: %v", err)
+ return fmt.Errorf("invalid path regex: %w", err)
}
if err := validateOptionalRegex(b.PathExcept); err != nil {
- return fmt.Errorf("invalid path-except regex: %v", err)
+ return fmt.Errorf("invalid path-except regex: %w", err)
}
if err := validateOptionalRegex(b.Text); err != nil {
- return fmt.Errorf("invalid text regex: %v", err)
+ return fmt.Errorf("invalid text regex: %w", err)
}
if err := validateOptionalRegex(b.Source); err != nil {
- return fmt.Errorf("invalid source regex: %v", err)
+ return fmt.Errorf("invalid source regex: %w", err)
}
nonBlank := 0
if len(b.Linters) > 0 {
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/config/linters_settings.go b/vendor/github.com/golangci/golangci-lint/pkg/config/linters_settings.go
index 0fee9f81e..a3206f597 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/config/linters_settings.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/config/linters_settings.go
@@ -74,6 +74,9 @@ var defaultLintersSettings = LintersSettings{
MaxDeclLines: 1,
MaxDeclChars: 30,
},
+ Inamedparam: INamedParamSettings{
+ SkipSingleParam: false,
+ },
InterfaceBloat: InterfaceBloatSettings{
Max: 10,
},
@@ -104,6 +107,12 @@ var defaultLintersSettings = LintersSettings{
RequireSpecific: false,
AllowUnused: false,
},
+ PerfSprint: PerfSprintSettings{
+ IntConversion: true,
+ ErrError: false,
+ ErrorF: true,
+ SprintF1: true,
+ },
Prealloc: PreallocSettings{
Simple: true,
RangeLoops: true,
@@ -114,9 +123,13 @@ var defaultLintersSettings = LintersSettings{
Qualified: false,
},
SlogLint: SlogLintSettings{
+ NoMixedArgs: true,
KVOnly: false,
AttrOnly: false,
+ ContextOnly: false,
+ StaticMsg: false,
NoRawKeys: false,
+ KeyNamingCase: "",
ArgsOnSepLines: false,
},
TagAlign: TagAlignSettings{
@@ -206,6 +219,7 @@ type LintersSettings struct {
Grouper GrouperSettings
Ifshort IfshortSettings
ImportAs ImportAsSettings
+ Inamedparam INamedParamSettings
InterfaceBloat InterfaceBloatSettings
Ireturn IreturnSettings
Lll LllSettings
@@ -222,20 +236,23 @@ type LintersSettings struct {
NoLintLint NoLintLintSettings
NoNamedReturns NoNamedReturnsSettings
ParallelTest ParallelTestSettings
+ PerfSprint PerfSprintSettings
Prealloc PreallocSettings
Predeclared PredeclaredSettings
Promlinter PromlinterSettings
+ ProtoGetter ProtoGetterSettings
Reassign ReassignSettings
Revive ReviveSettings
RowsErrCheck RowsErrCheckSettings
SlogLint SlogLintSettings
+ Spancheck SpancheckSettings
Staticcheck StaticCheckSettings
Structcheck StructCheckSettings
Stylecheck StaticCheckSettings
TagAlign TagAlignSettings
Tagliatelle TagliatelleSettings
- Testifylint TestifylintSettings
Tenv TenvSettings
+ Testifylint TestifylintSettings
Testpackage TestpackageSettings
Thelper ThelperSettings
Unparam UnparamSettings
@@ -279,9 +296,10 @@ type DepGuardSettings struct {
}
type DepGuardList struct {
- Files []string `mapstructure:"files"`
- Allow []string `mapstructure:"allow"`
- Deny []DepGuardDeny `mapstructure:"deny"`
+ ListMode string `mapstructure:"list-mode"`
+ Files []string `mapstructure:"files"`
+ Allow []string `mapstructure:"allow"`
+ Deny []DepGuardDeny `mapstructure:"deny"`
}
type DepGuardDeny struct {
@@ -345,6 +363,7 @@ type ExhaustiveSettings struct {
PackageScopeOnly bool `mapstructure:"package-scope-only"`
ExplicitExhaustiveMap bool `mapstructure:"explicit-exhaustive-map"`
ExplicitExhaustiveSwitch bool `mapstructure:"explicit-exhaustive-switch"`
+ DefaultCaseRequired bool `mapstructure:"default-case-required"`
}
type ExhaustiveStructSettings struct {
@@ -427,14 +446,15 @@ type GocognitSettings struct {
}
type GoConstSettings struct {
- IgnoreTests bool `mapstructure:"ignore-tests"`
- MatchWithConstants bool `mapstructure:"match-constant"`
- MinStringLen int `mapstructure:"min-len"`
- MinOccurrencesCount int `mapstructure:"min-occurrences"`
- ParseNumbers bool `mapstructure:"numbers"`
- NumberMin int `mapstructure:"min"`
- NumberMax int `mapstructure:"max"`
- IgnoreCalls bool `mapstructure:"ignore-calls"`
+ IgnoreStrings string `mapstructure:"ignore-strings"`
+ IgnoreTests bool `mapstructure:"ignore-tests"`
+ MatchWithConstants bool `mapstructure:"match-constant"`
+ MinStringLen int `mapstructure:"min-len"`
+ MinOccurrencesCount int `mapstructure:"min-occurrences"`
+ ParseNumbers bool `mapstructure:"numbers"`
+ NumberMin int `mapstructure:"min"`
+ NumberMax int `mapstructure:"max"`
+ IgnoreCalls bool `mapstructure:"ignore-calls"`
}
type GoCriticSettings struct {
@@ -599,6 +619,10 @@ type ImportAsAlias struct {
Alias string
}
+type INamedParamSettings struct {
+ SkipSingleParam bool `mapstructure:"skip-single-param"`
+}
+
type InterfaceBloatSettings struct {
Max int `mapstructure:"max"`
}
@@ -636,8 +660,9 @@ type MalignedSettings struct {
}
type MisspellSettings struct {
+ Mode string `mapstructure:"mode"`
Locale string
- // TODO(ldez): v2 the options must be renamed to `IgnoredRules`.
+ // TODO(ldez): v2 the option must be renamed to `IgnoredRules`.
IgnoreWords []string `mapstructure:"ignore-words"`
}
@@ -675,11 +700,19 @@ type NoLintLintSettings struct {
type NoNamedReturnsSettings struct {
ReportErrorInDefer bool `mapstructure:"report-error-in-defer"`
}
+
type ParallelTestSettings struct {
IgnoreMissing bool `mapstructure:"ignore-missing"`
IgnoreMissingSubtests bool `mapstructure:"ignore-missing-subtests"`
}
+type PerfSprintSettings struct {
+ IntConversion bool `mapstructure:"int-conversion"`
+ ErrError bool `mapstructure:"err-error"`
+ ErrorF bool `mapstructure:"errorf"`
+ SprintF1 bool `mapstructure:"sprintf1"`
+}
+
type PreallocSettings struct {
Simple bool
RangeLoops bool `mapstructure:"range-loops"`
@@ -696,6 +729,13 @@ type PromlinterSettings struct {
DisabledLinters []string `mapstructure:"disabled-linters"`
}
+type ProtoGetterSettings struct {
+ SkipGeneratedBy []string `mapstructure:"skip-generated-by"`
+ SkipFiles []string `mapstructure:"skip-files"`
+ SkipAnyGenerated bool `mapstructure:"skip-any-generated"`
+ ReplaceFirstArgInAppend bool `mapstructure:"replace-first-arg-in-append"`
+}
+
type ReassignSettings struct {
Patterns []string `mapstructure:"patterns"`
}
@@ -725,10 +765,19 @@ type RowsErrCheckSettings struct {
}
type SlogLintSettings struct {
- KVOnly bool `mapstructure:"kv-only"`
- AttrOnly bool `mapstructure:"attr-only"`
- NoRawKeys bool `mapstructure:"no-raw-keys"`
- ArgsOnSepLines bool `mapstructure:"args-on-sep-lines"`
+ NoMixedArgs bool `mapstructure:"no-mixed-args"`
+ KVOnly bool `mapstructure:"kv-only"`
+ AttrOnly bool `mapstructure:"attr-only"`
+ ContextOnly bool `mapstructure:"context-only"`
+ StaticMsg bool `mapstructure:"static-msg"`
+ NoRawKeys bool `mapstructure:"no-raw-keys"`
+ KeyNamingCase string `mapstructure:"key-naming-case"`
+ ArgsOnSepLines bool `mapstructure:"args-on-sep-lines"`
+}
+
+type SpancheckSettings struct {
+ Checks []string `mapstructure:"checks"`
+ IgnoreCheckSignatures []string `mapstructure:"ignore-check-signatures"`
}
type StaticCheckSettings struct {
@@ -764,13 +813,19 @@ type TagliatelleSettings struct {
}
type TestifylintSettings struct {
- EnableAll bool `mapstructure:"enable-all"`
- EnabledCheckers []string `mapstructure:"enable"`
+ EnableAll bool `mapstructure:"enable-all"`
+ DisableAll bool `mapstructure:"disable-all"`
+ EnabledCheckers []string `mapstructure:"enable"`
+ DisabledCheckers []string `mapstructure:"disable"`
ExpectedActual struct {
ExpVarPattern string `mapstructure:"pattern"`
} `mapstructure:"expected-actual"`
+ RequireError struct {
+ FnPattern string `mapstructure:"fn-pattern"`
+ } `mapstructure:"require-error"`
+
SuiteExtraAssertCall struct {
Mode string `mapstructure:"mode"`
} `mapstructure:"suite-extra-assert-call"`
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/config/reader.go b/vendor/github.com/golangci/golangci-lint/pkg/config/reader.go
index de203876e..0c4fa13b0 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/config/reader.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/config/reader.go
@@ -5,12 +5,12 @@ import (
"fmt"
"os"
"path/filepath"
+ "slices"
"strings"
+ "github.com/go-viper/mapstructure/v2"
"github.com/mitchellh/go-homedir"
- "github.com/mitchellh/mapstructure"
"github.com/spf13/viper"
- "golang.org/x/exp/slices"
"github.com/golangci/golangci-lint/pkg/exitcodes"
"github.com/golangci/golangci-lint/pkg/fsutils"
@@ -38,11 +38,11 @@ func (r *FileReader) Read() error {
configFile, err := r.parseConfigOption()
if err != nil {
- if err == errConfigDisabled {
+ if errors.Is(err, errConfigDisabled) {
return nil
}
- return fmt.Errorf("can't parse --config option: %s", err)
+ return fmt.Errorf("can't parse --config option: %w", err)
}
if configFile != "" {
@@ -65,7 +65,7 @@ func (r *FileReader) parseConfig() error {
return nil
}
- return fmt.Errorf("can't read viper config: %s", err)
+ return fmt.Errorf("can't read viper config: %w", err)
}
usedConfigFile := viper.ConfigFileUsed()
@@ -100,11 +100,11 @@ func (r *FileReader) parseConfig() error {
// Needed for forbidigo.
mapstructure.TextUnmarshallerHookFunc(),
))); err != nil {
- return fmt.Errorf("can't unmarshal config by viper: %s", err)
+ return fmt.Errorf("can't unmarshal config by viper: %w", err)
}
if err := r.validateConfig(); err != nil {
- return fmt.Errorf("can't validate config: %s", err)
+ return fmt.Errorf("can't validate config: %w", err)
}
if r.cfg.InternalTest { // just for testing purposes: to detect config file usage
@@ -138,7 +138,7 @@ func (r *FileReader) validateConfig() error {
}
for i, rule := range c.Issues.ExcludeRules {
if err := rule.Validate(); err != nil {
- return fmt.Errorf("error in exclude rule #%d: %v", i, err)
+ return fmt.Errorf("error in exclude rule #%d: %w", i, err)
}
}
if len(c.Severity.Rules) > 0 && c.Severity.Default == "" {
@@ -146,11 +146,11 @@ func (r *FileReader) validateConfig() error {
}
for i, rule := range c.Severity.Rules {
if err := rule.Validate(); err != nil {
- return fmt.Errorf("error in severity rule #%d: %v", i, err)
+ return fmt.Errorf("error in severity rule #%d: %w", i, err)
}
}
if err := c.LintersSettings.Govet.Validate(); err != nil {
- return fmt.Errorf("error in govet config: %v", err)
+ return fmt.Errorf("error in govet config: %w", err)
}
return nil
}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/config/run.go b/vendor/github.com/golangci/golangci-lint/pkg/config/run.go
index ff812d0a2..2bb21d9fa 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/config/run.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/config/run.go
@@ -37,4 +37,6 @@ type Run struct {
AllowParallelRunners bool `mapstructure:"allow-parallel-runners"`
AllowSerialRunners bool `mapstructure:"allow-serial-runners"`
+
+ ShowStats bool `mapstructure:"show-stats"`
}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/fsutils/fsutils.go b/vendor/github.com/golangci/golangci-lint/pkg/fsutils/fsutils.go
index a39c105e4..715a3a4af 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/fsutils/fsutils.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/fsutils/fsutils.go
@@ -34,7 +34,7 @@ func Getwd() (string, error) {
evaledWd, err := EvalSymlinks(cachedWd)
if err != nil {
- cachedWd, cachedWdError = "", fmt.Errorf("can't eval symlinks on wd %s: %s", cachedWd, err)
+ cachedWd, cachedWdError = "", fmt.Errorf("can't eval symlinks on wd %s: %w", cachedWd, err)
return
}
@@ -70,13 +70,13 @@ func ShortestRelPath(path, wd string) (string, error) {
var err error
wd, err = Getwd()
if err != nil {
- return "", fmt.Errorf("can't get working directory: %s", err)
+ return "", fmt.Errorf("can't get working directory: %w", err)
}
}
evaledPath, err := EvalSymlinks(path)
if err != nil {
- return "", fmt.Errorf("can't eval symlinks for path %s: %s", path, err)
+ return "", fmt.Errorf("can't eval symlinks for path %s: %w", path, err)
}
path = evaledPath
@@ -92,7 +92,7 @@ func ShortestRelPath(path, wd string) (string, error) {
relPath, err := filepath.Rel(wd, absPath)
if err != nil {
- return "", fmt.Errorf("can't get relative path for path %s and root %s: %s",
+ return "", fmt.Errorf("can't get relative path for path %s and root %s: %w",
absPath, wd, err)
}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/asciicheck.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/asciicheck.go
index df301b417..7e7ee05e5 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/asciicheck.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/asciicheck.go
@@ -8,10 +8,12 @@ import (
)
func NewAsciicheck() *goanalysis.Linter {
+ a := asciicheck.NewAnalyzer()
+
return goanalysis.NewLinter(
- "asciicheck",
- "Simple linter to check that your code does not contain non-ASCII identifiers",
- []*analysis.Analyzer{asciicheck.NewAnalyzer()},
+ a.Name,
+ a.Doc,
+ []*analysis.Analyzer{a},
nil,
).WithLoadMode(goanalysis.LoadModeSyntax)
}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/bidichk.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/bidichk.go
index e1b347176..ef266f55c 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/bidichk.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/bidichk.go
@@ -51,7 +51,7 @@ func NewBiDiChkFuncName(cfg *config.BiDiChkSettings) *goanalysis.Linter {
}
return goanalysis.NewLinter(
- "bidichk",
+ a.Name,
"Checks for dangerous unicode character sequences",
[]*analysis.Analyzer{a},
cfgMap,
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/cyclop.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/cyclop.go
index 5ad65f122..f76c55552 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/cyclop.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/cyclop.go
@@ -8,8 +8,6 @@ import (
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
)
-const cyclopName = "cyclop"
-
func NewCyclop(settings *config.Cyclop) *goanalysis.Linter {
a := analyzer.NewAnalyzer()
@@ -31,7 +29,7 @@ func NewCyclop(settings *config.Cyclop) *goanalysis.Linter {
}
return goanalysis.NewLinter(
- cyclopName,
+ a.Name,
"checks function and package cyclomatic complexity",
[]*analysis.Analyzer{a},
cfg,
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/depguard.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/depguard.go
index 23986708c..49e471df8 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/depguard.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/depguard.go
@@ -15,8 +15,9 @@ func NewDepguard(settings *config.DepGuardSettings) *goanalysis.Linter {
if settings != nil {
for s, rule := range settings.Rules {
list := &depguard.List{
- Files: rule.Files,
- Allow: rule.Allow,
+ ListMode: rule.ListMode,
+ Files: rule.Files,
+ Allow: rule.Allow,
}
// because of bug with Viper parsing (split on dot) we use a list of struct instead of a map.
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/errchkjson.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/errchkjson.go
index 171de00a4..1af4450b4 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/errchkjson.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/errchkjson.go
@@ -23,10 +23,8 @@ func NewErrChkJSONFuncName(cfg *config.ErrChkJSONSettings) *goanalysis.Linter {
}
return goanalysis.NewLinter(
- "errchkjson",
- "Checks types passed to the json encoding functions. "+
- "Reports unsupported types and optionally reports occasions, "+
- "where the check for the returned error can be omitted.",
+ a.Name,
+ a.Doc,
[]*analysis.Analyzer{a},
cfgMap,
).WithLoadMode(goanalysis.LoadModeTypesInfo)
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/errname.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/errname.go
index 96564cfa8..193a7aba7 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/errname.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/errname.go
@@ -8,10 +8,12 @@ import (
)
func NewErrName() *goanalysis.Linter {
+ a := analyzer.New()
+
return goanalysis.NewLinter(
- "errname",
- "Checks that sentinel errors are prefixed with the `Err` and error types are suffixed with the `Error`.",
- []*analysis.Analyzer{analyzer.New()},
+ a.Name,
+ a.Doc,
+ []*analysis.Analyzer{a},
nil,
).WithLoadMode(goanalysis.LoadModeTypesInfo)
}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/exhaustive.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/exhaustive.go
index 3824afa0b..fe58e10f0 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/exhaustive.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/exhaustive.go
@@ -23,6 +23,7 @@ func NewExhaustive(settings *config.ExhaustiveSettings) *goanalysis.Linter {
exhaustive.PackageScopeOnlyFlag: settings.PackageScopeOnly,
exhaustive.ExplicitExhaustiveMapFlag: settings.ExplicitExhaustiveMap,
exhaustive.ExplicitExhaustiveSwitchFlag: settings.ExplicitExhaustiveSwitch,
+ exhaustive.DefaultCaseRequiredFlag: settings.DefaultCaseRequired,
},
}
}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner.go
index 46871bc5b..a8660b612 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner.go
@@ -17,6 +17,7 @@ import (
"sort"
"sync"
+ "golang.org/x/exp/maps"
"golang.org/x/tools/go/analysis"
"golang.org/x/tools/go/packages"
@@ -159,10 +160,7 @@ func (r *runner) buildActionFactDeps(act *action, a *analysis.Analyzer, pkg *pac
act.objectFacts = make(map[objectFactKey]analysis.Fact)
act.packageFacts = make(map[packageFactKey]analysis.Fact)
- paths := make([]string, 0, len(pkg.Imports))
- for path := range pkg.Imports {
- paths = append(paths, path)
- }
+ paths := maps.Keys(pkg.Imports)
sort.Strings(paths) // for determinism
for _, path := range paths {
dep := r.makeAction(a, pkg.Imports[path], initialPkgs, actions, actAlloc)
@@ -212,10 +210,7 @@ func (r *runner) prepareAnalysis(pkgs []*packages.Package,
}
}
- allActions := make([]*action, 0, len(actions))
- for _, act := range actions {
- allActions = append(allActions, act)
- }
+ allActions := maps.Values(actions)
debugf("Built %d actions", len(actions))
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go
index 5ded9fac9..6b57cb0c9 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go
@@ -9,7 +9,6 @@ import (
"runtime/debug"
"time"
- "github.com/hashicorp/go-multierror"
"golang.org/x/tools/go/analysis"
"golang.org/x/tools/go/packages"
"golang.org/x/tools/go/types/objectpath"
@@ -126,20 +125,16 @@ func (act *action) analyze() {
}(time.Now())
// Report an error if any dependency failures.
- var depErrors *multierror.Error
+ var depErrors error
for _, dep := range act.deps {
if dep.err == nil {
continue
}
- depErrors = multierror.Append(depErrors, errors.Unwrap(dep.err))
+ depErrors = errors.Join(depErrors, errors.Unwrap(dep.err))
}
if depErrors != nil {
- depErrors.ErrorFormat = func(e []error) string {
- return fmt.Sprintf("failed prerequisites: %v", e)
- }
-
- act.err = depErrors
+ act.err = fmt.Errorf("failed prerequisites: %w", depErrors)
return
}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/gochecksumtype.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/gochecksumtype.go
index fcc0cad58..5516179df 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/gochecksumtype.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/gochecksumtype.go
@@ -45,7 +45,7 @@ func NewGoCheckSumType() *goanalysis.Linter {
`Run exhaustiveness checks on Go "sum types"`,
[]*analysis.Analyzer{analyzer},
nil,
- ).WithIssuesReporter(func(ctx *linter.Context) []goanalysis.Issue {
+ ).WithIssuesReporter(func(_ *linter.Context) []goanalysis.Issue {
return resIssues
}).WithLoadMode(goanalysis.LoadModeTypesInfo)
}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/goconst.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/goconst.go
index e277509d2..b51885275 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/goconst.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/goconst.go
@@ -53,6 +53,7 @@ func NewGoconst(settings *config.GoConstSettings) *goanalysis.Linter {
func runGoconst(pass *analysis.Pass, settings *config.GoConstSettings) ([]goanalysis.Issue, error) {
cfg := goconstAPI.Config{
+ IgnoreStrings: settings.IgnoreStrings,
IgnoreTests: settings.IgnoreTests,
MatchWithConstants: settings.MatchWithConstants,
MinStringLength: settings.MinStringLen,
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/gocritic.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/gocritic.go
index 1319c72d9..3cf43afc6 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/gocritic.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/gocritic.go
@@ -14,6 +14,7 @@ import (
"github.com/go-critic/go-critic/checkers"
gocriticlinter "github.com/go-critic/go-critic/linter"
+ "golang.org/x/exp/maps"
"golang.org/x/tools/go/analysis"
"github.com/golangci/golangci-lint/pkg/config"
@@ -219,10 +220,7 @@ func (w *goCriticWrapper) configureCheckerInfo(info *gocriticlinter.CheckerInfo,
info.Name, k)
}
- var supportedKeys []string
- for sk := range info.Params {
- supportedKeys = append(supportedKeys, sk)
- }
+ supportedKeys := maps.Keys(info.Params)
sort.Strings(supportedKeys)
return fmt.Errorf("checker %s config param %s doesn't exist, all existing: %s",
@@ -311,11 +309,7 @@ func (s *goCriticSettingsWrapper) checkerTagsDebugf() {
tagToCheckers := s.buildTagToCheckersMap()
- allTags := make([]string, 0, len(tagToCheckers))
- for tag := range tagToCheckers {
- allTags = append(allTags, tag)
- }
-
+ allTags := maps.Keys(tagToCheckers)
sort.Strings(allTags)
goCriticDebugf("All gocritic existing tags and checks:")
@@ -609,12 +603,7 @@ func intersectStringSlice(s1, s2 []string) []string {
}
func sprintAllowedCheckerNames(allowedNames map[string]bool) string {
- namesSlice := make([]string, 0, len(allowedNames))
-
- for name := range allowedNames {
- namesSlice = append(namesSlice, name)
- }
-
+ namesSlice := maps.Keys(allowedNames)
return sprintStrings(namesSlice)
}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/golint.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/golint.go
index a6fc73c9e..22ca59048 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/golint.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/golint.go
@@ -56,7 +56,7 @@ func runGoLint(pass *analysis.Pass, settings *config.GoLintSettings) ([]goanalys
ps, err := l.LintPkg(pass.Files, pass.Fset, pass.Pkg, pass.TypesInfo)
if err != nil {
- return nil, fmt.Errorf("can't lint %d files: %s", len(pass.Files), err)
+ return nil, fmt.Errorf("can't lint %d files: %w", len(pass.Files), err)
}
if len(ps) == 0 {
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/goprintffuncname.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/goprintffuncname.go
index c5516dc7f..e513718ba 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/goprintffuncname.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/goprintffuncname.go
@@ -8,10 +8,12 @@ import (
)
func NewGoPrintfFuncName() *goanalysis.Linter {
+ a := analyzer.Analyzer
+
return goanalysis.NewLinter(
- "goprintffuncname",
- "Checks that printf-like functions are named with `f` at the end",
- []*analysis.Analyzer{analyzer.Analyzer},
+ a.Name,
+ a.Doc,
+ []*analysis.Analyzer{a},
nil,
).WithLoadMode(goanalysis.LoadModeSyntax)
}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/govet.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/govet.go
index 4e16fb142..a0d33835d 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/govet.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/govet.go
@@ -1,6 +1,8 @@
package golinters
import (
+ "slices"
+
"golang.org/x/tools/go/analysis"
"golang.org/x/tools/go/analysis/passes/appends"
"golang.org/x/tools/go/analysis/passes/asmdecl"
@@ -170,36 +172,25 @@ func analyzersFromConfig(settings *config.GovetSettings) []*analysis.Analyzer {
}
func isAnalyzerEnabled(name string, cfg *config.GovetSettings, defaultAnalyzers []*analysis.Analyzer) bool {
- if cfg.EnableAll {
- for _, n := range cfg.Disable {
- if n == name {
- return false
- }
- }
- return true
+ // TODO(ldez) remove loopclosure when go1.23
+ if name == loopclosure.Analyzer.Name && config.IsGreaterThanOrEqualGo122(cfg.Go) {
+ return false
}
- // Raw for loops should be OK on small slice lengths.
- for _, n := range cfg.Enable {
- if n == name {
- return true
- }
- }
+ switch {
+ case cfg.EnableAll:
+ return !slices.Contains(cfg.Disable, name)
- for _, n := range cfg.Disable {
- if n == name {
- return false
- }
- }
+ case slices.Contains(cfg.Enable, name):
+ return true
- if cfg.DisableAll {
+ case slices.Contains(cfg.Disable, name):
return false
- }
- for _, a := range defaultAnalyzers {
- if a.Name == name {
- return true
- }
+ case cfg.DisableAll:
+ return false
+
+ default:
+ return slices.ContainsFunc(defaultAnalyzers, func(a *analysis.Analyzer) bool { return a.Name == name })
}
- return false
}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/grouper.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/grouper.go
index 9feecf3ba..41761f2ae 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/grouper.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/grouper.go
@@ -25,7 +25,7 @@ func NewGrouper(settings *config.GrouperSettings) *goanalysis.Linter {
return goanalysis.NewLinter(
"grouper",
- "An analyzer to analyze expression groups.",
+ "Analyze expression groups.",
[]*analysis.Analyzer{grouper.New()},
linterCfg,
).WithLoadMode(goanalysis.LoadModeSyntax)
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/ifshort.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/ifshort.go
index 1574eaf70..50e2c172e 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/ifshort.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/ifshort.go
@@ -19,10 +19,12 @@ func NewIfshort(settings *config.IfshortSettings) *goanalysis.Linter {
}
}
+ a := analyzer.Analyzer
+
return goanalysis.NewLinter(
- "ifshort",
- "Checks that your code uses short syntax for if-statements whenever possible",
- []*analysis.Analyzer{analyzer.Analyzer},
+ a.Name,
+ a.Doc,
+ []*analysis.Analyzer{a},
cfg,
).WithLoadMode(goanalysis.LoadModeSyntax)
}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/inamedparam.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/inamedparam.go
index 290630755..887f3db2a 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/inamedparam.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/inamedparam.go
@@ -4,16 +4,27 @@ import (
"github.com/macabu/inamedparam"
"golang.org/x/tools/go/analysis"
+ "github.com/golangci/golangci-lint/pkg/config"
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
)
-func NewINamedParam() *goanalysis.Linter {
+func NewINamedParam(settings *config.INamedParamSettings) *goanalysis.Linter {
a := inamedparam.Analyzer
+ var cfg map[string]map[string]any
+
+ if settings != nil {
+ cfg = map[string]map[string]any{
+ a.Name: {
+ "skip-single-param": settings.SkipSingleParam,
+ },
+ }
+ }
+
return goanalysis.NewLinter(
a.Name,
a.Doc,
[]*analysis.Analyzer{a},
- nil,
+ cfg,
).WithLoadMode(goanalysis.LoadModeSyntax)
}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/ineffassign.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/ineffassign.go
index c87bb2fa5..ac5eb20ad 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/ineffassign.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/ineffassign.go
@@ -8,10 +8,12 @@ import (
)
func NewIneffassign() *goanalysis.Linter {
+ a := ineffassign.Analyzer
+
return goanalysis.NewLinter(
- "ineffassign",
+ a.Name,
"Detects when assignments to existing variables are not used",
- []*analysis.Analyzer{ineffassign.Analyzer},
+ []*analysis.Analyzer{a},
nil,
).WithLoadMode(goanalysis.LoadModeSyntax)
}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/ireturn.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/ireturn.go
index 34dc09d26..dc09dad0e 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/ireturn.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/ireturn.go
@@ -16,8 +16,9 @@ func NewIreturn(settings *config.IreturnSettings) *goanalysis.Linter {
cfg := map[string]map[string]any{}
if settings != nil {
cfg[a.Name] = map[string]any{
- "allow": strings.Join(settings.Allow, ","),
- "reject": strings.Join(settings.Reject, ","),
+ "allow": strings.Join(settings.Allow, ","),
+ "reject": strings.Join(settings.Reject, ","),
+ "nonolint": true,
}
}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/lll.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/lll.go
index 9ed320120..61498087a 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/lll.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/lll.go
@@ -2,6 +2,7 @@ package golinters
import (
"bufio"
+ "errors"
"fmt"
"go/token"
"os"
@@ -82,7 +83,7 @@ func getLLLIssuesForFile(filename string, maxLineLen int, tabSpaces string) ([]r
f, err := os.Open(filename)
if err != nil {
- return nil, fmt.Errorf("can't open file %s: %s", filename, err)
+ return nil, fmt.Errorf("can't open file %s: %w", filename, err)
}
defer f.Close()
@@ -127,7 +128,7 @@ func getLLLIssuesForFile(filename string, maxLineLen int, tabSpaces string) ([]r
}
if err := scanner.Err(); err != nil {
- if err == bufio.ErrTooLong && maxLineLen < bufio.MaxScanTokenSize {
+ if errors.Is(err, bufio.ErrTooLong) && maxLineLen < bufio.MaxScanTokenSize {
// scanner.Scan() might fail if the line is longer than bufio.MaxScanTokenSize
// In the case where the specified maxLineLen is smaller than bufio.MaxScanTokenSize
// we can return this line as a long line instead of returning an error.
@@ -148,7 +149,7 @@ func getLLLIssuesForFile(filename string, maxLineLen int, tabSpaces string) ([]r
FromLinter: lllName,
})
} else {
- return nil, fmt.Errorf("can't scan file %s: %s", filename, err)
+ return nil, fmt.Errorf("can't scan file %s: %w", filename, err)
}
}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/mirror.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/mirror.go
index 4adc001a1..d6e2bb06a 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/mirror.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/mirror.go
@@ -39,7 +39,7 @@ func NewMirror() *goanalysis.Linter {
Pos: i.Start,
}
- if len(i.InlineFix) > 0 {
+ if i.InlineFix != "" {
issue.Replacement = &result.Replacement{
Inline: &result.InlineFix{
StartCol: i.Start.Column - 1,
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/misspell.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/misspell.go
index ce2b79a7c..0f69cdb87 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/misspell.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/misspell.go
@@ -29,7 +29,7 @@ func NewMisspell(settings *config.MisspellSettings) *goanalysis.Linter {
return goanalysis.NewLinter(
misspellName,
- "Finds commonly misspelled English words in comments",
+ "Finds commonly misspelled English words",
[]*analysis.Analyzer{analyzer},
nil,
).WithContextSetter(func(lintCtx *linter.Context) {
@@ -40,7 +40,7 @@ func NewMisspell(settings *config.MisspellSettings) *goanalysis.Linter {
return nil, ruleErr
}
- issues, err := runMisspell(lintCtx, pass, replacer)
+ issues, err := runMisspell(lintCtx, pass, replacer, settings.Mode)
if err != nil {
return nil, err
}
@@ -60,15 +60,16 @@ func NewMisspell(settings *config.MisspellSettings) *goanalysis.Linter {
}).WithLoadMode(goanalysis.LoadModeSyntax)
}
-func runMisspell(lintCtx *linter.Context, pass *analysis.Pass, replacer *misspell.Replacer) ([]goanalysis.Issue, error) {
+func runMisspell(lintCtx *linter.Context, pass *analysis.Pass, replacer *misspell.Replacer, mode string) ([]goanalysis.Issue, error) {
fileNames := getFileNames(pass)
var issues []goanalysis.Issue
for _, filename := range fileNames {
- lintIssues, err := runMisspellOnFile(lintCtx, filename, replacer)
+ lintIssues, err := runMisspellOnFile(lintCtx, filename, replacer, mode)
if err != nil {
return nil, err
}
+
for i := range lintIssues {
issues = append(issues, goanalysis.NewIssue(&lintIssues[i], pass))
}
@@ -104,25 +105,36 @@ func createMisspellReplacer(settings *config.MisspellSettings) (*misspell.Replac
return replacer, nil
}
-func runMisspellOnFile(lintCtx *linter.Context, filename string, replacer *misspell.Replacer) ([]result.Issue, error) {
- var res []result.Issue
+func runMisspellOnFile(lintCtx *linter.Context, filename string, replacer *misspell.Replacer, mode string) ([]result.Issue, error) {
fileContent, err := lintCtx.FileCache.GetFileBytes(filename)
if err != nil {
- return nil, fmt.Errorf("can't get file %s contents: %s", filename, err)
+ return nil, fmt.Errorf("can't get file %s contents: %w", filename, err)
}
- // use r.Replace, not r.ReplaceGo because r.ReplaceGo doesn't find
- // issues inside strings: it searches only inside comments. r.Replace
- // searches all words: it treats input as a plain text. A standalone misspell
- // tool uses r.Replace by default.
- _, diffs := replacer.Replace(string(fileContent))
+ // `r.ReplaceGo` doesn't find issues inside strings: it searches only inside comments.
+ // `r.Replace` searches all words: it treats input as a plain text.
+ // The standalone misspell tool uses `r.Replace` by default.
+ var replace func(input string) (string, []misspell.Diff)
+ switch strings.ToLower(mode) {
+ case "restricted":
+ replace = replacer.ReplaceGo
+ default:
+ replace = replacer.Replace
+ }
+
+ _, diffs := replace(string(fileContent))
+
+ var res []result.Issue
+
for _, diff := range diffs {
text := fmt.Sprintf("`%s` is a misspelling of `%s`", diff.Original, diff.Corrected)
+
pos := token.Position{
Filename: filename,
Line: diff.Line,
Column: diff.Column + 1,
}
+
replacement := &result.Replacement{
Inline: &result.InlineFix{
StartCol: diff.Column,
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/musttag.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/musttag.go
index d9ea7efc7..72d919582 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/musttag.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/musttag.go
@@ -1,7 +1,7 @@
package golinters
import (
- "go.tmz.dev/musttag"
+ "go-simpler.org/musttag"
"golang.org/x/tools/go/analysis"
"github.com/golangci/golangci-lint/pkg/config"
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/nakedret.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/nakedret.go
index d276ac6a9..6153860fb 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/nakedret.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/nakedret.go
@@ -8,20 +8,18 @@ import (
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
)
-const nakedretName = "nakedret"
-
func NewNakedret(settings *config.NakedretSettings) *goanalysis.Linter {
var maxLines int
if settings != nil {
maxLines = settings.MaxFuncLines
}
- analyzer := nakedret.NakedReturnAnalyzer(uint(maxLines))
+ a := nakedret.NakedReturnAnalyzer(uint(maxLines))
return goanalysis.NewLinter(
- nakedretName,
- "Finds naked returns in functions greater than a specified function length",
- []*analysis.Analyzer{analyzer},
+ a.Name,
+ a.Doc,
+ []*analysis.Analyzer{a},
nil,
).WithLoadMode(goanalysis.LoadModeSyntax)
}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/noctx.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/noctx.go
index b7fcd2a73..cff9c97dc 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/noctx.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/noctx.go
@@ -8,10 +8,12 @@ import (
)
func NewNoctx() *goanalysis.Linter {
+ a := noctx.Analyzer
+
return goanalysis.NewLinter(
- "noctx",
- "noctx finds sending http request without context.Context",
- []*analysis.Analyzer{noctx.Analyzer},
+ a.Name,
+ "Finds sending http request without context.Context",
+ []*analysis.Analyzer{a},
nil,
).WithLoadMode(goanalysis.LoadModeTypesInfo)
}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/nolintlint.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/nolintlint.go
index 00ef1f833..ae372ab79 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/nolintlint.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/nolintlint.go
@@ -76,7 +76,7 @@ func runNoLintLint(pass *analysis.Pass, settings *config.NoLintLintSettings) ([]
lintIssues, err := lnt.Run(pass.Fset, nodes...)
if err != nil {
- return nil, fmt.Errorf("linter failed to run: %s", err)
+ return nil, fmt.Errorf("linter failed to run: %w", err)
}
var issues []goanalysis.Issue
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/nolintlint/nolintlint.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/nolintlint/nolintlint.go
index 9c6b10f38..a245561a0 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/nolintlint/nolintlint.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/nolintlint/nolintlint.go
@@ -19,12 +19,12 @@ type BaseIssue struct {
replacement *result.Replacement
}
-//nolint:gocritic // TODO must be change in the future.
+//nolint:gocritic // TODO(ldez) must be change in the future.
func (b BaseIssue) Position() token.Position {
return b.position
}
-//nolint:gocritic // TODO must be change in the future.
+//nolint:gocritic // TODO(ldez) must be change in the future.
func (b BaseIssue) Replacement() *result.Replacement {
return b.replacement
}
@@ -33,53 +33,49 @@ type ExtraLeadingSpace struct {
BaseIssue
}
-//nolint:gocritic // TODO must be change in the future.
+//nolint:gocritic // TODO(ldez) must be change in the future.
func (i ExtraLeadingSpace) Details() string {
return fmt.Sprintf("directive `%s` should not have more than one leading space", i.fullDirective)
}
-//nolint:gocritic // TODO must be change in the future.
func (i ExtraLeadingSpace) String() string { return toString(i) }
type NotMachine struct {
BaseIssue
}
-//nolint:gocritic // TODO must be change in the future.
+//nolint:gocritic // TODO(ldez) must be change in the future.
func (i NotMachine) Details() string {
expected := i.fullDirective[:2] + strings.TrimLeftFunc(i.fullDirective[2:], unicode.IsSpace)
return fmt.Sprintf("directive `%s` should be written without leading space as `%s`",
i.fullDirective, expected)
}
-//nolint:gocritic // TODO must be change in the future.
func (i NotMachine) String() string { return toString(i) }
type NotSpecific struct {
BaseIssue
}
-//nolint:gocritic // TODO must be change in the future.
+//nolint:gocritic // TODO(ldez) must be change in the future.
func (i NotSpecific) Details() string {
return fmt.Sprintf("directive `%s` should mention specific linter such as `%s:my-linter`",
i.fullDirective, i.directiveWithOptionalLeadingSpace)
}
-//nolint:gocritic // TODO must be change in the future.
func (i NotSpecific) String() string { return toString(i) }
type ParseError struct {
BaseIssue
}
-//nolint:gocritic // TODO must be change in the future.
+//nolint:gocritic // TODO(ldez) must be change in the future.
func (i ParseError) Details() string {
return fmt.Sprintf("directive `%s` should match `%s[:<comma-separated-linters>] [// <explanation>]`",
i.fullDirective,
i.directiveWithOptionalLeadingSpace)
}
-//nolint:gocritic // TODO must be change in the future.
func (i ParseError) String() string { return toString(i) }
type NoExplanation struct {
@@ -87,13 +83,12 @@ type NoExplanation struct {
fullDirectiveWithoutExplanation string
}
-//nolint:gocritic // TODO must be change in the future.
+//nolint:gocritic // TODO(ldez) must be change in the future.
func (i NoExplanation) Details() string {
return fmt.Sprintf("directive `%s` should provide explanation such as `%s // this is why`",
i.fullDirective, i.fullDirectiveWithoutExplanation)
}
-//nolint:gocritic // TODO must be change in the future.
func (i NoExplanation) String() string { return toString(i) }
type UnusedCandidate struct {
@@ -101,7 +96,7 @@ type UnusedCandidate struct {
ExpectedLinter string
}
-//nolint:gocritic // TODO must be change in the future.
+//nolint:gocritic // TODO(ldez) must be change in the future.
func (i UnusedCandidate) Details() string {
details := fmt.Sprintf("directive `%s` is unused", i.fullDirective)
if i.ExpectedLinter != "" {
@@ -110,7 +105,6 @@ func (i UnusedCandidate) Details() string {
return details
}
-//nolint:gocritic // TODO must be change in the future.
func (i UnusedCandidate) String() string { return toString(i) }
func toString(i Issue) string {
@@ -185,7 +179,7 @@ func (l Linter) Run(fset *token.FileSet, nodes ...ast.Node) ([]Issue, error) {
}
directiveWithOptionalLeadingSpace := "//"
- if len(leadingSpace) > 0 {
+ if leadingSpace != "" {
directiveWithOptionalLeadingSpace += " "
}
@@ -202,7 +196,7 @@ func (l Linter) Run(fset *token.FileSet, nodes ...ast.Node) ([]Issue, error) {
}
// check for, report and eliminate leading spaces, so we can check for other issues
- if len(leadingSpace) > 0 {
+ if leadingSpace != "" {
removeWhitespace := &result.Replacement{
Inline: &result.InlineFix{
StartCol: pos.Column + 1,
@@ -231,7 +225,7 @@ func (l Linter) Run(fset *token.FileSet, nodes ...ast.Node) ([]Issue, error) {
lintersText, explanation := fullMatches[1], fullMatches[2]
var linters []string
- if len(lintersText) > 0 && !strings.HasPrefix(lintersText, "all") {
+ if lintersText != "" && !strings.HasPrefix(lintersText, "all") {
lls := strings.Split(lintersText, ",")
linters = make([]string, 0, len(lls))
rangeStart := (pos.Column - 1) + len("//") + len(leadingSpace) + len("nolint:")
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/paralleltest.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/paralleltest.go
index 4c03952c1..c49f74aa2 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/paralleltest.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/paralleltest.go
@@ -22,8 +22,8 @@ func NewParallelTest(settings *config.ParallelTestSettings) *goanalysis.Linter {
}
return goanalysis.NewLinter(
- "paralleltest",
- "paralleltest detects missing usage of t.Parallel() method in your Go test",
+ a.Name,
+ "Detects missing usage of t.Parallel() method in your Go test",
[]*analysis.Analyzer{a},
cfg,
).WithLoadMode(goanalysis.LoadModeTypesInfo)
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/perfsprint.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/perfsprint.go
index fb248a85d..acaa3a522 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/perfsprint.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/perfsprint.go
@@ -4,16 +4,28 @@ import (
"github.com/catenacyber/perfsprint/analyzer"
"golang.org/x/tools/go/analysis"
+ "github.com/golangci/golangci-lint/pkg/config"
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
)
-func NewPerfSprint() *goanalysis.Linter {
- a := analyzer.Analyzer
+func NewPerfSprint(settings *config.PerfSprintSettings) *goanalysis.Linter {
+ a := analyzer.New()
+
+ cfg := map[string]map[string]any{
+ a.Name: {"fiximports": false},
+ }
+
+ if settings != nil {
+ cfg[a.Name]["int-conversion"] = settings.IntConversion
+ cfg[a.Name]["err-error"] = settings.ErrError
+ cfg[a.Name]["errorf"] = settings.ErrorF
+ cfg[a.Name]["sprintf1"] = settings.SprintF1
+ }
return goanalysis.NewLinter(
a.Name,
a.Doc,
[]*analysis.Analyzer{a},
- nil,
+ cfg,
).WithLoadMode(goanalysis.LoadModeTypesInfo)
}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/protogetter.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/protogetter.go
index 23325ad55..9a5e7b4db 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/protogetter.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/protogetter.go
@@ -6,18 +6,33 @@ import (
"github.com/ghostiam/protogetter"
"golang.org/x/tools/go/analysis"
+ "github.com/golangci/golangci-lint/pkg/config"
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
"github.com/golangci/golangci-lint/pkg/lint/linter"
"github.com/golangci/golangci-lint/pkg/result"
)
-func NewProtoGetter() *goanalysis.Linter {
+func NewProtoGetter(settings *config.ProtoGetterSettings) *goanalysis.Linter {
var mu sync.Mutex
var resIssues []goanalysis.Issue
- a := protogetter.NewAnalyzer()
+ var cfg protogetter.Config
+ if settings != nil {
+ cfg = protogetter.Config{
+ SkipGeneratedBy: settings.SkipGeneratedBy,
+ SkipFiles: settings.SkipFiles,
+ SkipAnyGenerated: settings.SkipAnyGenerated,
+ ReplaceFirstArgInAppend: settings.ReplaceFirstArgInAppend,
+ }
+ }
+ cfg.Mode = protogetter.GolangciLintMode
+
+ a := protogetter.NewAnalyzer(&cfg)
a.Run = func(pass *analysis.Pass) (any, error) {
- pgIssues := protogetter.Run(pass, protogetter.GolangciLintMode)
+ pgIssues, err := protogetter.Run(pass, &cfg)
+ if err != nil {
+ return nil, err
+ }
issues := make([]goanalysis.Issue, len(pgIssues))
for i, issue := range pgIssues {
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/revive.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/revive.go
index 28231957c..46d8b1c9c 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/revive.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/revive.go
@@ -34,7 +34,7 @@ type jsonObject struct {
// NewRevive returns a new Revive linter.
//
-//nolint:dupl
+
func NewRevive(settings *config.ReviveSettings) *goanalysis.Linter {
var mu sync.Mutex
var resIssues []goanalysis.Issue
@@ -247,7 +247,7 @@ func safeTomlSlice(r []any) []any {
}
// This element is not exported by revive, so we need copy the code.
-// Extracted from https://github.com/mgechev/revive/blob/v1.3.4/config/config.go#L15
+// Extracted from https://github.com/mgechev/revive/blob/v1.3.7/config/config.go#L15
var defaultRules = []lint.Rule{
&rule.VarDeclarationsRule{},
&rule.PackageCommentsRule{},
@@ -290,7 +290,7 @@ var allRules = append([]lint.Rule{
&rule.ModifiesValRecRule{},
&rule.ConstantLogicalExprRule{},
&rule.BoolLiteralRule{},
- &rule.ImportsBlacklistRule{},
+ &rule.ImportsBlocklistRule{},
&rule.FunctionResultsLimitRule{},
&rule.MaxPublicStructsRule{},
&rule.RangeValInClosureRule{},
@@ -327,6 +327,9 @@ var allRules = append([]lint.Rule{
&rule.RedundantImportAlias{},
&rule.ImportAliasNamingRule{},
&rule.EnforceMapStyleRule{},
+ &rule.EnforceRepeatedArgTypeStyleRule{},
+ &rule.EnforceSliceStyleRule{},
+ &rule.MaxControlNestingRule{},
}, defaultRules...)
const defaultConfidence = 0.8
@@ -349,8 +352,8 @@ func normalizeConfig(cfg *lint.Config) {
}
if cfg.EnableAllRules {
// Add to the configuration all rules not yet present in it
- for _, rule := range allRules {
- ruleName := rule.Name()
+ for _, r := range allRules {
+ ruleName := r.Name()
_, alreadyInConf := cfg.Rules[ruleName]
if alreadyInConf {
continue
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/rowserrcheck.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/rowserrcheck.go
index 5a66d62e7..d67efd069 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/rowserrcheck.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/rowserrcheck.go
@@ -14,12 +14,12 @@ func NewRowsErrCheck(settings *config.RowsErrCheckSettings) *goanalysis.Linter {
pkgs = settings.Packages
}
- analyzer := rowserr.NewAnalyzer(pkgs...)
+ a := rowserr.NewAnalyzer(pkgs...)
return goanalysis.NewLinter(
- "rowserrcheck",
- "checks whether Err of rows is checked successfully",
- []*analysis.Analyzer{analyzer},
+ a.Name,
+ "checks whether Rows.Err of rows is checked successfully",
+ []*analysis.Analyzer{a},
nil,
).WithLoadMode(goanalysis.LoadModeTypesInfo)
}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/sloglint.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/sloglint.go
index b506d187f..acea90d53 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/sloglint.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/sloglint.go
@@ -12,9 +12,13 @@ func NewSlogLint(settings *config.SlogLintSettings) *goanalysis.Linter {
var opts *sloglint.Options
if settings != nil {
opts = &sloglint.Options{
+ NoMixedArgs: settings.NoMixedArgs,
KVOnly: settings.KVOnly,
AttrOnly: settings.AttrOnly,
+ ContextOnly: settings.ContextOnly,
+ StaticMsg: settings.StaticMsg,
NoRawKeys: settings.NoRawKeys,
+ KeyNamingCase: settings.KeyNamingCase,
ArgsOnSepLines: settings.ArgsOnSepLines,
}
}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/spancheck.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/spancheck.go
new file mode 100644
index 000000000..934124477
--- /dev/null
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/spancheck.go
@@ -0,0 +1,29 @@
+package golinters
+
+import (
+ "github.com/jjti/go-spancheck"
+ "golang.org/x/tools/go/analysis"
+
+ "github.com/golangci/golangci-lint/pkg/config"
+ "github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
+)
+
+func NewSpancheck(settings *config.SpancheckSettings) *goanalysis.Linter {
+ cfg := spancheck.NewDefaultConfig()
+
+ if settings != nil {
+ if settings.Checks != nil {
+ cfg.EnabledChecks = settings.Checks
+ }
+
+ if settings.IgnoreCheckSignatures != nil {
+ cfg.IgnoreChecksSignaturesSlice = settings.IgnoreCheckSignatures
+ }
+ }
+
+ a := spancheck.NewAnalyzerWithConfig(cfg)
+
+ return goanalysis.
+ NewLinter(a.Name, a.Doc, []*analysis.Analyzer{a}, nil).
+ WithLoadMode(goanalysis.LoadModeTypesInfo)
+}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/sqlclosecheck.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/sqlclosecheck.go
index ff2c0c08f..e63b292a2 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/sqlclosecheck.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/sqlclosecheck.go
@@ -8,12 +8,12 @@ import (
)
func NewSQLCloseCheck() *goanalysis.Linter {
+ a := analyzer.NewAnalyzer()
+
return goanalysis.NewLinter(
- "sqlclosecheck",
- "Checks that sql.Rows and sql.Stmt are closed.",
- []*analysis.Analyzer{
- analyzer.NewAnalyzer(),
- },
+ a.Name,
+ a.Doc,
+ []*analysis.Analyzer{a},
nil,
).WithLoadMode(goanalysis.LoadModeTypesInfo)
}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/stylecheck.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/stylecheck.go
index 2e1e21c5b..d9b0f87c8 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/stylecheck.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/stylecheck.go
@@ -15,7 +15,7 @@ func NewStylecheck(settings *config.StaticCheckSettings) *goanalysis.Linter {
// `scconfig.Analyzer` is a singleton, then it's not possible to have more than one instance for all staticcheck "sub-linters".
// When we will merge the 4 "sub-linters", the problem will disappear: https://github.com/golangci/golangci-lint/issues/357
// Currently only stylecheck analyzer has a configuration in staticcheck.
- scconfig.Analyzer.Run = func(pass *analysis.Pass) (any, error) {
+ scconfig.Analyzer.Run = func(_ *analysis.Pass) (any, error) {
return cfg, nil
}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/testifylint.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/testifylint.go
index 83bae2868..d9cfc04f6 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/testifylint.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/testifylint.go
@@ -14,14 +14,22 @@ func NewTestifylint(settings *config.TestifylintSettings) *goanalysis.Linter {
cfg := make(map[string]map[string]any)
if settings != nil {
cfg[a.Name] = map[string]any{
- "enable-all": settings.EnableAll,
+ "enable-all": settings.EnableAll,
+ "disable-all": settings.DisableAll,
}
if len(settings.EnabledCheckers) > 0 {
cfg[a.Name]["enable"] = settings.EnabledCheckers
}
+ if len(settings.DisabledCheckers) > 0 {
+ cfg[a.Name]["disable"] = settings.DisabledCheckers
+ }
+
if p := settings.ExpectedActual.ExpVarPattern; p != "" {
cfg[a.Name]["expected-actual.pattern"] = p
}
+ if p := settings.RequireError.FnPattern; p != "" {
+ cfg[a.Name]["require-error.fn-pattern"] = p
+ }
if m := settings.SuiteExtraAssertCall.Mode; m != "" {
cfg[a.Name]["suite-extra-assert-call.mode"] = m
}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/thelper.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/thelper.go
index 84a8e9e8b..1ae85ef42 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/thelper.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/thelper.go
@@ -4,6 +4,7 @@ import (
"strings"
"github.com/kulti/thelper/pkg/analyzer"
+ "golang.org/x/exp/maps"
"golang.org/x/tools/go/analysis"
"github.com/golangci/golangci-lint/pkg/config"
@@ -42,10 +43,7 @@ func NewThelper(cfg *config.ThelperSettings) *goanalysis.Linter {
linterLogger.Fatalf("thelper: at least one option must be enabled")
}
- var args []string
- for k := range opts {
- args = append(args, k)
- }
+ args := maps.Keys(opts)
cfgMap := map[string]map[string]any{
a.Name: {
@@ -54,8 +52,8 @@ func NewThelper(cfg *config.ThelperSettings) *goanalysis.Linter {
}
return goanalysis.NewLinter(
- "thelper",
- "thelper detects Go test helpers without t.Helper() call and checks the consistency of test helpers",
+ a.Name,
+ a.Doc,
[]*analysis.Analyzer{a},
cfgMap,
).WithLoadMode(goanalysis.LoadModeTypesInfo)
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/tparallel.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/tparallel.go
index cbe97516c..643f2c271 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/tparallel.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/tparallel.go
@@ -8,10 +8,11 @@ import (
)
func NewTparallel() *goanalysis.Linter {
+ a := tparallel.Analyzer
return goanalysis.NewLinter(
- "tparallel",
- "tparallel detects inappropriate usage of t.Parallel() method in your Go test codes",
- []*analysis.Analyzer{tparallel.Analyzer},
+ a.Name,
+ a.Doc,
+ []*analysis.Analyzer{a},
nil,
).WithLoadMode(goanalysis.LoadModeTypesInfo)
}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/unused.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/unused.go
index 89ae7e98a..a93061c96 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/unused.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/unused.go
@@ -47,7 +47,7 @@ func NewUnused(settings *config.UnusedSettings, scSettings *config.StaticCheckSe
"Checks Go code for unused constants, variables, functions and types",
[]*analysis.Analyzer{analyzer},
nil,
- ).WithIssuesReporter(func(lintCtx *linter.Context) []goanalysis.Issue {
+ ).WithIssuesReporter(func(_ *linter.Context) []goanalysis.Issue {
return resIssues
}).WithLoadMode(goanalysis.LoadModeTypesInfo)
}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/varcheck.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/varcheck.go
index 495c5b59f..ea735672f 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/varcheck.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/varcheck.go
@@ -30,7 +30,7 @@ func NewVarcheck(settings *config.VarCheckSettings) *goanalysis.Linter {
"Finds unused global variables and constants",
[]*analysis.Analyzer{analyzer},
nil,
- ).WithContextSetter(func(lintCtx *linter.Context) {
+ ).WithContextSetter(func(_ *linter.Context) {
analyzer.Run = func(pass *analysis.Pass) (any, error) {
issues := runVarCheck(pass, settings)
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/wastedassign.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/wastedassign.go
index 92798d4f7..9038c827d 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/wastedassign.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/wastedassign.go
@@ -8,10 +8,12 @@ import (
)
func NewWastedAssign() *goanalysis.Linter {
+ a := wastedassign.Analyzer
+
return goanalysis.NewLinter(
- "wastedassign",
- "wastedassign finds wasted assignment statements.",
- []*analysis.Analyzer{wastedassign.Analyzer},
+ a.Name,
+ "Finds wasted assignment statements",
+ []*analysis.Analyzer{a},
nil,
).WithLoadMode(goanalysis.LoadModeTypesInfo)
}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/whitespace.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/whitespace.go
index e5941fa5d..5487b1016 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/whitespace.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/whitespace.go
@@ -2,7 +2,6 @@ package golinters
import (
"fmt"
- "go/token"
"sync"
"github.com/ultraware/whitespace"
@@ -16,7 +15,6 @@ import (
const whitespaceName = "whitespace"
-//nolint:dupl
func NewWhitespace(settings *config.WhitespaceSettings) *goanalysis.Linter {
var mu sync.Mutex
var resIssues []goanalysis.Issue
@@ -24,25 +22,22 @@ func NewWhitespace(settings *config.WhitespaceSettings) *goanalysis.Linter {
var wsSettings whitespace.Settings
if settings != nil {
wsSettings = whitespace.Settings{
+ Mode: whitespace.RunningModeGolangCI,
MultiIf: settings.MultiIf,
MultiFunc: settings.MultiFunc,
}
}
- analyzer := &analysis.Analyzer{
- Name: whitespaceName,
- Doc: goanalysis.TheOnlyanalyzerDoc,
- Run: goanalysis.DummyRun,
- }
+ a := whitespace.NewAnalyzer(&wsSettings)
return goanalysis.NewLinter(
- whitespaceName,
- "Tool for detection of leading and trailing whitespace",
- []*analysis.Analyzer{analyzer},
+ a.Name,
+ a.Doc,
+ []*analysis.Analyzer{a},
nil,
- ).WithContextSetter(func(lintCtx *linter.Context) {
- analyzer.Run = func(pass *analysis.Pass) (any, error) {
- issues, err := runWhitespace(lintCtx, pass, wsSettings)
+ ).WithContextSetter(func(_ *linter.Context) {
+ a.Run = func(pass *analysis.Pass) (any, error) {
+ issues, err := runWhitespace(pass, wsSettings)
if err != nil {
return nil, err
}
@@ -62,46 +57,45 @@ func NewWhitespace(settings *config.WhitespaceSettings) *goanalysis.Linter {
}).WithLoadMode(goanalysis.LoadModeSyntax)
}
-func runWhitespace(lintCtx *linter.Context, pass *analysis.Pass, wsSettings whitespace.Settings) ([]goanalysis.Issue, error) {
- var messages []whitespace.Message
- for _, file := range pass.Files {
- messages = append(messages, whitespace.Run(file, pass.Fset, wsSettings)...)
- }
-
- if len(messages) == 0 {
- return nil, nil
- }
+func runWhitespace(pass *analysis.Pass, wsSettings whitespace.Settings) ([]goanalysis.Issue, error) {
+ lintIssues := whitespace.Run(pass, &wsSettings)
- issues := make([]goanalysis.Issue, len(messages))
- for k, i := range messages {
- issue := result.Issue{
- Pos: token.Position{
- Filename: i.Pos.Filename,
- Line: i.Pos.Line,
- },
- LineRange: &result.Range{From: i.Pos.Line, To: i.Pos.Line},
- Text: i.Message,
- FromLinter: whitespaceName,
- Replacement: &result.Replacement{},
+ issues := make([]goanalysis.Issue, len(lintIssues))
+ for i, issue := range lintIssues {
+ report := &result.Issue{
+ FromLinter: whitespaceName,
+ Pos: pass.Fset.PositionFor(issue.Diagnostic, false),
+ Text: issue.Message,
}
- bracketLine, err := lintCtx.LineCache.GetLine(issue.Pos.Filename, issue.Pos.Line)
- if err != nil {
- return nil, fmt.Errorf("failed to get line %s:%d: %w", issue.Pos.Filename, issue.Pos.Line, err)
- }
+ switch issue.MessageType {
+ case whitespace.MessageTypeRemove:
+ if len(issue.LineNumbers) == 0 {
+ continue
+ }
+
+ report.LineRange = &result.Range{
+ From: issue.LineNumbers[0],
+ To: issue.LineNumbers[len(issue.LineNumbers)-1],
+ }
+
+ report.Replacement = &result.Replacement{NeedOnlyDelete: true}
+
+ case whitespace.MessageTypeAdd:
+ report.Pos = pass.Fset.PositionFor(issue.FixStart, false)
+ report.Replacement = &result.Replacement{
+ Inline: &result.InlineFix{
+ StartCol: 0,
+ Length: 1,
+ NewString: "\n\t",
+ },
+ }
- switch i.Type {
- case whitespace.MessageTypeLeading:
- issue.LineRange.To++ // cover two lines by the issue: opening bracket "{" (issue.Pos.Line) and following empty line
- case whitespace.MessageTypeTrailing:
- issue.LineRange.From-- // cover two lines by the issue: closing bracket "}" (issue.Pos.Line) and preceding empty line
- issue.Pos.Line-- // set in sync with LineRange.From to not break fixer and other code features
- case whitespace.MessageTypeAddAfter:
- bracketLine += "\n"
+ default:
+ return nil, fmt.Errorf("unknown message type: %v", issue.MessageType)
}
- issue.Replacement.NewLines = []string{bracketLine}
- issues[k] = goanalysis.NewIssue(&issue, pass)
+ issues[i] = goanalysis.NewIssue(report, pass)
}
return issues, nil
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/wrapcheck.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/wrapcheck.go
index 098eb87ba..6d25db427 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/wrapcheck.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/wrapcheck.go
@@ -8,8 +8,6 @@ import (
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
)
-const wrapcheckName = "wrapcheck"
-
func NewWrapcheck(settings *config.WrapcheckSettings) *goanalysis.Linter {
cfg := wrapcheck.NewDefaultConfig()
if settings != nil {
@@ -30,7 +28,7 @@ func NewWrapcheck(settings *config.WrapcheckSettings) *goanalysis.Linter {
a := wrapcheck.NewAnalyzer(cfg)
return goanalysis.NewLinter(
- wrapcheckName,
+ a.Name,
a.Doc,
[]*analysis.Analyzer{a},
nil,
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/wsl.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/wsl.go
index 05697a629..3b090a686 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/wsl.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/wsl.go
@@ -1,89 +1,39 @@
package golinters
import (
- "sync"
-
- "github.com/bombsimon/wsl/v3"
+ "github.com/bombsimon/wsl/v4"
"golang.org/x/tools/go/analysis"
"github.com/golangci/golangci-lint/pkg/config"
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
- "github.com/golangci/golangci-lint/pkg/lint/linter"
- "github.com/golangci/golangci-lint/pkg/result"
)
-const wslName = "wsl"
-
-// NewWSL returns a new WSL linter.
func NewWSL(settings *config.WSLSettings) *goanalysis.Linter {
- var mu sync.Mutex
- var resIssues []goanalysis.Issue
-
- conf := wsl.DefaultConfig()
-
+ var conf *wsl.Configuration
if settings != nil {
- conf.StrictAppend = settings.StrictAppend
- conf.AllowAssignAndCallCuddle = settings.AllowAssignAndCallCuddle
- conf.AllowAssignAndAnythingCuddle = settings.AllowAssignAndAnythingCuddle
- conf.AllowMultiLineAssignCuddle = settings.AllowMultiLineAssignCuddle
- conf.ForceCaseTrailingWhitespaceLimit = settings.ForceCaseTrailingWhitespaceLimit
- conf.AllowTrailingComment = settings.AllowTrailingComment
- conf.AllowSeparatedLeadingComment = settings.AllowSeparatedLeadingComment
- conf.AllowCuddleDeclaration = settings.AllowCuddleDeclaration
- conf.AllowCuddleWithCalls = settings.AllowCuddleWithCalls
- conf.AllowCuddleWithRHS = settings.AllowCuddleWithRHS
- conf.ForceCuddleErrCheckAndAssign = settings.ForceCuddleErrCheckAndAssign
- conf.ErrorVariableNames = settings.ErrorVariableNames
- conf.ForceExclusiveShortDeclarations = settings.ForceExclusiveShortDeclarations
+ conf = &wsl.Configuration{
+ StrictAppend: settings.StrictAppend,
+ AllowAssignAndCallCuddle: settings.AllowAssignAndCallCuddle,
+ AllowAssignAndAnythingCuddle: settings.AllowAssignAndAnythingCuddle,
+ AllowMultiLineAssignCuddle: settings.AllowMultiLineAssignCuddle,
+ ForceCaseTrailingWhitespaceLimit: settings.ForceCaseTrailingWhitespaceLimit,
+ AllowTrailingComment: settings.AllowTrailingComment,
+ AllowSeparatedLeadingComment: settings.AllowSeparatedLeadingComment,
+ AllowCuddleDeclaration: settings.AllowCuddleDeclaration,
+ AllowCuddleWithCalls: settings.AllowCuddleWithCalls,
+ AllowCuddleWithRHS: settings.AllowCuddleWithRHS,
+ ForceCuddleErrCheckAndAssign: settings.ForceCuddleErrCheckAndAssign,
+ ErrorVariableNames: settings.ErrorVariableNames,
+ ForceExclusiveShortDeclarations: settings.ForceExclusiveShortDeclarations,
+ }
}
- analyzer := &analysis.Analyzer{
- Name: goanalysis.TheOnlyAnalyzerName,
- Doc: goanalysis.TheOnlyanalyzerDoc,
- Run: func(pass *analysis.Pass) (any, error) {
- issues := runWSL(pass, &conf)
-
- if len(issues) == 0 {
- return nil, nil
- }
-
- mu.Lock()
- resIssues = append(resIssues, issues...)
- mu.Unlock()
-
- return nil, nil
- },
- }
+ a := wsl.NewAnalyzer(conf)
return goanalysis.NewLinter(
- wslName,
- "Whitespace Linter - Forces you to use empty lines!",
- []*analysis.Analyzer{analyzer},
+ a.Name,
+ a.Doc,
+ []*analysis.Analyzer{a},
nil,
- ).WithIssuesReporter(func(*linter.Context) []goanalysis.Issue {
- return resIssues
- }).WithLoadMode(goanalysis.LoadModeSyntax)
-}
-
-func runWSL(pass *analysis.Pass, conf *wsl.Configuration) []goanalysis.Issue {
- if conf == nil {
- return nil
- }
-
- files := getFileNames(pass)
- wslErrors, _ := wsl.NewProcessorWithConfig(*conf).ProcessFiles(files)
- if len(wslErrors) == 0 {
- return nil
- }
-
- var issues []goanalysis.Issue
- for _, err := range wslErrors {
- issues = append(issues, goanalysis.NewIssue(&result.Issue{
- FromLinter: wslName,
- Pos: err.Position,
- Text: err.Reason,
- }, pass))
- }
-
- return issues
+ ).WithLoadMode(goanalysis.LoadModeSyntax)
}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/golinters/zerologlint.go b/vendor/github.com/golangci/golangci-lint/pkg/golinters/zerologlint.go
index a37bca12e..edde72665 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/golinters/zerologlint.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/golinters/zerologlint.go
@@ -8,10 +8,12 @@ import (
)
func NewZerologLint() *goanalysis.Linter {
+ a := zerologlint.Analyzer
+
return goanalysis.NewLinter(
- "zerologlint",
- "Detects the wrong usage of `zerolog` that a user forgets to dispatch with `Send` or `Msg`.",
- []*analysis.Analyzer{zerologlint.Analyzer},
+ a.Name,
+ a.Doc,
+ []*analysis.Analyzer{a},
nil,
).WithLoadMode(goanalysis.LoadModeTypesInfo)
}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/lint/linter/config.go b/vendor/github.com/golangci/golangci-lint/pkg/lint/linter/config.go
index c911b5613..ed5e5508c 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/lint/linter/config.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/lint/linter/config.go
@@ -134,11 +134,11 @@ func (lc *Config) Name() string {
}
func (lc *Config) WithNoopFallback(cfg *config.Config) *Config {
- if cfg != nil && config.IsGreaterThanOrEqualGo121(cfg.Run.Go) {
+ if cfg != nil && config.IsGreaterThanOrEqualGo122(cfg.Run.Go) {
lc.Linter = &Noop{
name: lc.Linter.Name(),
desc: lc.Linter.Desc(),
- run: func(pass *analysis.Pass) (any, error) {
+ run: func(_ *analysis.Pass) (any, error) {
return nil, nil
},
}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/lint/lintersdb/custom_linters.go b/vendor/github.com/golangci/golangci-lint/pkg/lint/lintersdb/custom_linters.go
index d0eaa7905..188c14d91 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/lint/lintersdb/custom_linters.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/lint/lintersdb/custom_linters.go
@@ -1,12 +1,11 @@
package lintersdb
import (
+ "errors"
"fmt"
- "os"
"path/filepath"
"plugin"
- "github.com/hashicorp/go-multierror"
"github.com/spf13/viper"
"golang.org/x/tools/go/analysis"
@@ -71,7 +70,7 @@ func (m *Manager) getAnalyzerPlugin(path string, settings any) ([]*analysis.Anal
configFilePath := viper.ConfigFileUsed()
absConfigFilePath, err := filepath.Abs(configFilePath)
if err != nil {
- return nil, fmt.Errorf("could not get absolute representation of config file path %q: %v", configFilePath, err)
+ return nil, fmt.Errorf("could not get absolute representation of config file path %q: %w", configFilePath, err)
}
path = filepath.Join(filepath.Dir(absConfigFilePath), path)
}
@@ -94,8 +93,7 @@ func (m *Manager) lookupPlugin(plug *plugin.Plugin, settings any) ([]*analysis.A
if err != nil {
analyzers, errP := m.lookupAnalyzerPlugin(plug)
if errP != nil {
- // TODO(ldez): use `errors.Join` when we will upgrade to go1.20.
- return nil, multierror.Append(err, errP)
+ return nil, errors.Join(err, errP)
}
return analyzers, nil
@@ -116,11 +114,8 @@ func (m *Manager) lookupAnalyzerPlugin(plug *plugin.Plugin) ([]*analysis.Analyze
return nil, err
}
- // TODO(ldez): remove this env var (but keep the log) in the next minor version (v1.55.0)
- if _, ok := os.LookupEnv("GOLANGCI_LINT_HIDE_WARNING_ABOUT_PLUGIN_API_DEPRECATION"); !ok {
- m.log.Warnf("plugin: 'AnalyzerPlugin' plugins are deprecated, please use the new plugin signature: " +
- "https://golangci-lint.run/contributing/new-linters/#create-a-plugin")
- }
+ m.log.Warnf("plugin: 'AnalyzerPlugin' plugins are deprecated, please use the new plugin signature: " +
+ "https://golangci-lint.run/contributing/new-linters/#create-a-plugin")
analyzerPlugin, ok := symbol.(AnalyzerPlugin)
if !ok {
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/lint/lintersdb/enabled_set.go b/vendor/github.com/golangci/golangci-lint/pkg/lint/lintersdb/enabled_set.go
index c5c7874e4..6f7b91b4d 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/lint/lintersdb/enabled_set.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/lint/lintersdb/enabled_set.go
@@ -4,6 +4,8 @@ import (
"os"
"sort"
+ "golang.org/x/exp/maps"
+
"github.com/golangci/golangci-lint/pkg/config"
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
"github.com/golangci/golangci-lint/pkg/lint/linter"
@@ -115,10 +117,7 @@ func (es EnabledSet) GetOptimizedLinters() ([]*linter.Config, error) {
es.verbosePrintLintersStatus(resultLintersSet)
es.combineGoAnalysisLinters(resultLintersSet)
- var resultLinters []*linter.Config
- for _, lc := range resultLintersSet {
- resultLinters = append(resultLinters, lc)
- }
+ resultLinters := maps.Values(resultLintersSet)
// Make order of execution of linters (go/analysis metalinter and unused) stable.
sort.Slice(resultLinters, func(i, j int) bool {
@@ -185,10 +184,7 @@ func (es EnabledSet) combineGoAnalysisLinters(linters map[string]*linter.Config)
ml := goanalysis.NewMetaLinter(goanalysisLinters)
- var presets []string
- for p := range goanalysisPresets {
- presets = append(presets, p)
- }
+ presets := maps.Keys(goanalysisPresets)
mlConfig := &linter.Config{
Linter: ml,
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/lint/lintersdb/manager.go b/vendor/github.com/golangci/golangci-lint/pkg/lint/lintersdb/manager.go
index fd329ce57..fdc73ec73 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/lint/lintersdb/manager.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/lint/lintersdb/manager.go
@@ -105,6 +105,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
grouperCfg *config.GrouperSettings
ifshortCfg *config.IfshortSettings
importAsCfg *config.ImportAsSettings
+ inamedparamCfg *config.INamedParamSettings
interfaceBloatCfg *config.InterfaceBloatSettings
ireturnCfg *config.IreturnSettings
lllCfg *config.LllSettings
@@ -121,13 +122,16 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
noLintLintCfg *config.NoLintLintSettings
noNamedReturnsCfg *config.NoNamedReturnsSettings
parallelTestCfg *config.ParallelTestSettings
+ perfSprintCfg *config.PerfSprintSettings
preallocCfg *config.PreallocSettings
predeclaredCfg *config.PredeclaredSettings
promlinterCfg *config.PromlinterSettings
+ protogetterCfg *config.ProtoGetterSettings
reassignCfg *config.ReassignSettings
reviveCfg *config.ReviveSettings
rowserrcheckCfg *config.RowsErrCheckSettings
sloglintCfg *config.SlogLintSettings
+ spancheckCfg *config.SpancheckSettings
staticcheckCfg *config.StaticCheckSettings
structcheckCfg *config.StructCheckSettings
stylecheckCfg *config.StaticCheckSettings
@@ -187,6 +191,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
grouperCfg = &m.cfg.LintersSettings.Grouper
ifshortCfg = &m.cfg.LintersSettings.Ifshort
importAsCfg = &m.cfg.LintersSettings.ImportAs
+ inamedparamCfg = &m.cfg.LintersSettings.Inamedparam
interfaceBloatCfg = &m.cfg.LintersSettings.InterfaceBloat
ireturnCfg = &m.cfg.LintersSettings.Ireturn
lllCfg = &m.cfg.LintersSettings.Lll
@@ -202,14 +207,17 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
nlreturnCfg = &m.cfg.LintersSettings.Nlreturn
noLintLintCfg = &m.cfg.LintersSettings.NoLintLint
noNamedReturnsCfg = &m.cfg.LintersSettings.NoNamedReturns
- preallocCfg = &m.cfg.LintersSettings.Prealloc
parallelTestCfg = &m.cfg.LintersSettings.ParallelTest
+ perfSprintCfg = &m.cfg.LintersSettings.PerfSprint
+ preallocCfg = &m.cfg.LintersSettings.Prealloc
predeclaredCfg = &m.cfg.LintersSettings.Predeclared
promlinterCfg = &m.cfg.LintersSettings.Promlinter
+ protogetterCfg = &m.cfg.LintersSettings.ProtoGetter
reassignCfg = &m.cfg.LintersSettings.Reassign
reviveCfg = &m.cfg.LintersSettings.Revive
rowserrcheckCfg = &m.cfg.LintersSettings.RowsErrCheck
sloglintCfg = &m.cfg.LintersSettings.SlogLint
+ spancheckCfg = &m.cfg.LintersSettings.Spancheck
staticcheckCfg = &m.cfg.LintersSettings.Staticcheck
structcheckCfg = &m.cfg.LintersSettings.Structcheck
stylecheckCfg = &m.cfg.LintersSettings.Stylecheck
@@ -228,25 +236,22 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
wrapcheckCfg = &m.cfg.LintersSettings.Wrapcheck
wslCfg = &m.cfg.LintersSettings.WSL
- if govetCfg != nil {
- govetCfg.Go = m.cfg.Run.Go
- }
+ govetCfg.Go = m.cfg.Run.Go
- if gocriticCfg != nil {
- gocriticCfg.Go = trimGoVersion(m.cfg.Run.Go)
- }
+ gocriticCfg.Go = trimGoVersion(m.cfg.Run.Go)
- if gofumptCfg != nil && gofumptCfg.LangVersion == "" {
+ if gofumptCfg.LangVersion == "" {
gofumptCfg.LangVersion = m.cfg.Run.Go
}
- if staticcheckCfg != nil && staticcheckCfg.GoVersion == "" {
+ // staticcheck related linters.
+ if staticcheckCfg.GoVersion == "" {
staticcheckCfg.GoVersion = trimGoVersion(m.cfg.Run.Go)
}
- if gosimpleCfg != nil && gosimpleCfg.GoVersion == "" {
+ if gosimpleCfg.GoVersion == "" {
gosimpleCfg.GoVersion = trimGoVersion(m.cfg.Run.Go)
}
- if stylecheckCfg != nil && stylecheckCfg.GoVersion != "" {
+ if stylecheckCfg.GoVersion != "" {
stylecheckCfg.GoVersion = trimGoVersion(m.cfg.Run.Go)
}
}
@@ -580,7 +585,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
WithLoadForGoAnalysis().
WithURL("https://github.com/julz/importas"),
- linter.NewConfig(golinters.NewINamedParam()).
+ linter.NewConfig(golinters.NewINamedParam(inamedparamCfg)).
WithSince("v1.55.0").
WithPresets(linter.PresetStyle).
WithURL("https://github.com/macabu/inamedparam"),
@@ -654,7 +659,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
WithSince("v1.51.0").
WithLoadForGoAnalysis().
WithPresets(linter.PresetStyle, linter.PresetBugs).
- WithURL("https://github.com/tmzane/musttag"),
+ WithURL("https://github.com/go-simpler/musttag"),
linter.NewConfig(golinters.NewNakedret(nakedretCfg)).
WithSince("v1.19.0").
@@ -712,7 +717,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
WithPresets(linter.PresetStyle, linter.PresetTest).
WithURL("https://github.com/kunwardeep/paralleltest"),
- linter.NewConfig(golinters.NewPerfSprint()).
+ linter.NewConfig(golinters.NewPerfSprint(perfSprintCfg)).
WithSince("v1.55.0").
WithLoadForGoAnalysis().
WithPresets(linter.PresetPerformance).
@@ -733,7 +738,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
WithPresets(linter.PresetStyle).
WithURL("https://github.com/yeya24/promlinter"),
- linter.NewConfig(golinters.NewProtoGetter()).
+ linter.NewConfig(golinters.NewProtoGetter(protogetterCfg)).
WithSince("v1.55.0").
WithPresets(linter.PresetBugs).
WithLoadForGoAnalysis().
@@ -776,6 +781,12 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
WithLoadForGoAnalysis().
WithURL("https://github.com/ryanrolds/sqlclosecheck"),
+ linter.NewConfig(golinters.NewSpancheck(spancheckCfg)).
+ WithSince("v1.56.0").
+ WithLoadForGoAnalysis().
+ WithPresets(linter.PresetBugs).
+ WithURL("https://github.com/jjti/go-spancheck"),
+
linter.NewConfig(golinters.NewStaticcheck(staticcheckCfg)).
WithEnabledByDefault().
WithSince("v1.0.0").
@@ -977,7 +988,7 @@ func trimGoVersion(v string) string {
return ""
}
- exp := regexp.MustCompile(`(\d\.\d+)\.\d+`)
+ exp := regexp.MustCompile(`(\d\.\d+)(?:\.\d+|[a-z]+\d)`)
if exp.MatchString(v) {
return exp.FindStringSubmatch(v)[1]
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/lint/runner.go b/vendor/github.com/golangci/golangci-lint/pkg/lint/runner.go
index d270892d5..e7cb17555 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/lint/runner.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/lint/runner.go
@@ -2,11 +2,11 @@ package lint
import (
"context"
+ "errors"
"fmt"
"runtime/debug"
"strings"
- "github.com/hashicorp/go-multierror"
gopackages "golang.org/x/tools/go/packages"
"github.com/golangci/golangci-lint/internal/errorutil"
@@ -205,7 +205,7 @@ func (r Runner) Run(ctx context.Context, linters []*linter.Config, lintCtx *lint
defer sw.Print()
var (
- lintErrors *multierror.Error
+ lintErrors error
issues []result.Issue
)
@@ -214,7 +214,7 @@ func (r Runner) Run(ctx context.Context, linters []*linter.Config, lintCtx *lint
sw.TrackStage(lc.Name(), func() {
linterIssues, err := r.runLinterSafe(ctx, lintCtx, lc)
if err != nil {
- lintErrors = multierror.Append(lintErrors, fmt.Errorf("can't run linter %s: %w", lc.Linter.Name(), err))
+ lintErrors = errors.Join(lintErrors, fmt.Errorf("can't run linter %s", lc.Linter.Name()), err)
r.Log.Warnf("Can't run linter %s: %v", lc.Linter.Name(), err)
return
@@ -224,7 +224,7 @@ func (r Runner) Run(ctx context.Context, linters []*linter.Config, lintCtx *lint
})
}
- return r.processLintResults(issues), lintErrors.ErrorOrNil()
+ return r.processLintResults(issues), lintErrors
}
func (r *Runner) processIssues(issues []result.Issue, sw *timeutils.Stopwatch, statPerProcessor map[string]processorStat) []result.Issue {
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/packages/errors.go b/vendor/github.com/golangci/golangci-lint/pkg/packages/errors.go
index 489836712..ff37651af 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/packages/errors.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/packages/errors.go
@@ -18,7 +18,7 @@ func ParseErrorPosition(pos string) (*token.Position, error) {
file := parts[0]
line, err := strconv.Atoi(parts[1])
if err != nil {
- return nil, fmt.Errorf("can't parse line number %q: %s", parts[1], err)
+ return nil, fmt.Errorf("can't parse line number %q: %w", parts[1], err)
}
var column int
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/printers/checkstyle.go b/vendor/github.com/golangci/golangci-lint/pkg/printers/checkstyle.go
index 3762ca056..e32eef7f5 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/printers/checkstyle.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/printers/checkstyle.go
@@ -7,6 +7,7 @@ import (
"sort"
"github.com/go-xmlfmt/xmlfmt"
+ "golang.org/x/exp/maps"
"github.com/golangci/golangci-lint/pkg/result"
)
@@ -74,10 +75,7 @@ func (p Checkstyle) Print(issues []result.Issue) error {
file.Errors = append(file.Errors, newError)
}
- out.Files = make([]*checkstyleFile, 0, len(files))
- for _, file := range files {
- out.Files = append(out.Files, file)
- }
+ out.Files = maps.Values(files)
sort.Slice(out.Files, func(i, j int) bool {
return out.Files[i].Name < out.Files[j].Name
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/printers/github.go b/vendor/github.com/golangci/golangci-lint/pkg/printers/github.go
index c1da9df9c..f471d5a86 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/printers/github.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/printers/github.go
@@ -15,7 +15,7 @@ type github struct {
const defaultGithubSeverity = "error"
// NewGithub output format outputs issues according to GitHub actions format:
-// https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message
+// https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-error-message
func NewGithub(w io.Writer) Printer {
return &github{w: w}
}
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/printers/junitxml.go b/vendor/github.com/golangci/golangci-lint/pkg/printers/junitxml.go
index 86a3811e4..3e3f82f58 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/printers/junitxml.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/printers/junitxml.go
@@ -7,6 +7,8 @@ import (
"sort"
"strings"
+ "golang.org/x/exp/maps"
+
"github.com/golangci/golangci-lint/pkg/result"
)
@@ -71,9 +73,7 @@ func (p JunitXML) Print(issues []result.Issue) error {
}
var res testSuitesXML
- for _, val := range suites {
- res.TestSuites = append(res.TestSuites, val)
- }
+ res.TestSuites = maps.Values(suites)
sort.Slice(res.TestSuites, func(i, j int) bool {
return res.TestSuites[i].Suite < res.TestSuites[j].Suite
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/result/processors/diff.go b/vendor/github.com/golangci/golangci-lint/pkg/result/processors/diff.go
index 67104bab0..496d9c865 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/result/processors/diff.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/result/processors/diff.go
@@ -47,7 +47,7 @@ func (p Diff) Process(issues []result.Issue) ([]result.Issue, error) {
if p.patchFilePath != "" {
patch, err := os.ReadFile(p.patchFilePath)
if err != nil {
- return nil, fmt.Errorf("can't read from patch file %s: %s", p.patchFilePath, err)
+ return nil, fmt.Errorf("can't read from patch file %s: %w", p.patchFilePath, err)
}
patchReader = bytes.NewReader(patch)
} else if p.patch != "" {
@@ -60,7 +60,7 @@ func (p Diff) Process(issues []result.Issue) ([]result.Issue, error) {
WholeFiles: p.wholeFiles,
}
if err := c.Prepare(); err != nil {
- return nil, fmt.Errorf("can't prepare diff by revgrep: %s", err)
+ return nil, fmt.Errorf("can't prepare diff by revgrep: %w", err)
}
return transformIssues(issues, func(i *result.Issue) *result.Issue {
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/result/processors/nolint.go b/vendor/github.com/golangci/golangci-lint/pkg/result/processors/nolint.go
index 181d3bf1f..a72dd1ef2 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/result/processors/nolint.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/result/processors/nolint.go
@@ -9,6 +9,8 @@ import (
"sort"
"strings"
+ "golang.org/x/exp/maps"
+
"github.com/golangci/golangci-lint/pkg/golinters"
"github.com/golangci/golangci-lint/pkg/lint/linter"
"github.com/golangci/golangci-lint/pkg/lint/lintersdb"
@@ -289,10 +291,7 @@ func (p *Nolint) Finish() {
return
}
- unknownLinters := make([]string, 0, len(p.unknownLintersSet))
- for name := range p.unknownLintersSet {
- unknownLinters = append(unknownLinters, name)
- }
+ unknownLinters := maps.Keys(p.unknownLintersSet)
sort.Strings(unknownLinters)
p.log.Warnf("Found unknown linters in //nolint directives: %s", strings.Join(unknownLinters, ", "))
diff --git a/vendor/github.com/golangci/golangci-lint/pkg/result/processors/skip_files.go b/vendor/github.com/golangci/golangci-lint/pkg/result/processors/skip_files.go
index 9579bee84..6c1c58695 100644
--- a/vendor/github.com/golangci/golangci-lint/pkg/result/processors/skip_files.go
+++ b/vendor/github.com/golangci/golangci-lint/pkg/result/processors/skip_files.go
@@ -21,7 +21,7 @@ func NewSkipFiles(patterns []string, pathPrefix string) (*SkipFiles, error) {
p = fsutils.NormalizePathInRegex(p)
patternRe, err := regexp.Compile(p)
if err != nil {
- return nil, fmt.Errorf("can't compile regexp %q: %s", p, err)
+ return nil, fmt.Errorf("can't compile regexp %q: %w", p, err)
}
patternsRe = append(patternsRe, patternRe)
}