From cf0fdd4e38d1bdc000b2027a0ca580c773731770 Mon Sep 17 00:00:00 2001 From: golangci-releaser <65486276+golangci-releaser@users.noreply.github.com> Date: Wed, 29 Oct 2025 20:08:06 +0000 Subject: [PATCH] [create-pull-request] automated change --- .golangci.reference.yml | 58 ++++++++++++++++++++++++++++ docs/data/configuration_file.json | 2 +- docs/data/linters_info.json | 9 +++++ docs/data/thanks.json | 1 + jsonschema/golangci.jsonschema.json | 59 ++++++++++++++++++++++++++++- 5 files changed, 126 insertions(+), 3 deletions(-) diff --git a/.golangci.reference.yml b/.golangci.reference.yml index 90a34668e795..2adb14f8b4b7 100644 --- a/.golangci.reference.yml +++ b/.golangci.reference.yml @@ -85,6 +85,7 @@ linters: - mirror - misspell - mnd + - modernize - musttag - nakedret - nestif @@ -199,6 +200,7 @@ linters: - mirror - misspell - mnd + - modernize - musttag - nakedret - nestif @@ -396,6 +398,9 @@ linters: # Default: [] ignore: - "0C0C" + # Checks only comments, skip strings. + # Default: false + comments-only: true embeddedstructfieldcheck: # Checks that there is an empty space between the embedded fields and regular fields. @@ -809,6 +814,9 @@ linters: # Detects multiple imports of the same package under different aliases. # https://go-critic.com/overview.html#dupimport - dupImport + # Detects duplicated option function arguments in variadic function calls. + # https://go-critic.com/overview.html#dupoption + - dupOption # Detects suspicious duplicated sub-expressions. # https://go-critic.com/overview.html#dupsubexpr - dupSubExpr @@ -1043,6 +1051,9 @@ linters: # Detects Yoda style expressions and suggests to replace them. # https://go-critic.com/overview.html#yodastyleexpr - yodaStyleExpr + # Detects bytes.Repeat with 0 value. + # https://go-critic.com/overview.html#zerobyterepeat + - zeroByteRepeat # Enable all checks. # Default: false @@ -2106,6 +2117,47 @@ linters: - '^math\.' - '^http\.StatusText$' + modernize: + # List of analyzers to disable. + # By default, all analyzers are enabled. + disable: + # Replace interface{} with any. + - any + # Replace for-range over b.N with b.Loop. + - bloop + # Replace []byte(fmt.Sprintf) with fmt.Appendf. + - fmtappendf + # Remove redundant re-declaration of loop variables. + - forvar + # Replace explicit loops over maps with calls to maps package. + - mapsloop + # Replace if/else statements with calls to min or max. + - minmax + # Simplify code by using go1.26's new(expr). + - newexpr + # Suggest replacing omitempty with omitzero for struct fields. + - omitzero + # Replace 3-clause for loops with for-range over integers. + - rangeint + # Replace reflect.TypeOf(x) with TypeFor[T](). + - reflecttypefor + # Replace loops with slices.Contains or slices.ContainsFunc. + - slicescontains + # Replace sort.Slice with slices.Sort for basic types. + - slicessort + # Use iterators instead of Len/At-style APIs. + - stditerators + # Replace HasPrefix/TrimPrefix with CutPrefix. + - stringscutprefix + # Replace ranging over Split/Fields with SplitSeq/FieldsSeq. + - stringsseq + # Replace += with strings.Builder. + - stringsbuilder + # Replace context.WithCancel with t.Context in tests. + - testingcontext + # Replace wg.Add(1)/go/wg.Done() with wg.Go. + - waitgroup + musttag: # A set of custom functions to check in addition to the builtin ones. # Default: json, xml, gopkg.in/yaml.v3, BurntSushi/toml, mitchellh/mapstructure, jmoiron/sqlx @@ -2212,6 +2264,12 @@ linters: # Enable/disable optimization of hex formatting. # Default: true hex-format: false + # Enable/disable optimization of concat loop. + # Default: true + concat-loop: false + # Optimization of `concat-loop` even with other operations. + # Default: false + loop-other-ops: true prealloc: # IMPORTANT: we don't recommend using this linter before doing performance profiling. diff --git a/docs/data/configuration_file.json b/docs/data/configuration_file.json index 90de70627432..a2c64ea9efa2 100644 --- a/docs/data/configuration_file.json +++ b/docs/data/configuration_file.json @@ -1,7 +1,7 @@ { "formatters": "formatters:\n # Enable specific formatter.\n # Default: [] (uses standard Go formatting)\n enable:\n - gci\n - gofmt\n - gofumpt\n - goimports\n - golines\n - swaggo\n # Formatters settings.\n settings:\n # See the dedicated \"formatters.settings\" documentation section.\n option: value\n exclusions:\n # Log a warning if an exclusion path is unused.\n # Default: false\n warn-unused: true\n # Mode of the generated files analysis.\n #\n # - `strict`: sources are excluded by strictly following the Go generated file convention.\n # Source files that have lines matching only the following regular expression will be excluded: `^// Code generated .* DO NOT EDIT\\.$`\n # This line must appear before the first non-comment, non-blank text in the file.\n # https://go.dev/s/generatedcode\n # - `lax`: sources are excluded if they contain lines like `autogenerated file`, `code generated`, `do not edit`, etc.\n # - `disable`: disable the generated files exclusion.\n #\n # Default: lax\n generated: strict\n # Which file paths to exclude.\n # This option is ignored when using `--stdin` as the path is unknown.\n # Default: []\n paths:\n - \".*\\\\.my\\\\.go$\"\n - lib/bad.go\n", "issues": "issues:\n # Maximum issues count per one linter.\n # Set to 0 to disable.\n # Default: 50\n max-issues-per-linter: 0\n # Maximum count of issues with the same text.\n # Set to 0 to disable.\n # Default: 3\n max-same-issues: 0\n # Make issues output unique by line.\n # Default: true\n uniq-by-line: false\n # Show only new issues: if there are unstaged changes or untracked files,\n # only those changes are analyzed, else only changes in HEAD~ are analyzed.\n # It's a super-useful option for integration of golangci-lint into existing large codebase.\n # It's not practical to fix all existing issues at the moment of integration:\n # much better don't allow issues in new code.\n #\n # Default: false\n new: true\n # Show only new issues created after the best common ancestor (merge-base against HEAD).\n # Default: \"\"\n new-from-merge-base: main\n # Show only new issues created after git revision `REV`.\n # Default: \"\"\n new-from-rev: HEAD\n # Show only new issues created in git patch with set file path.\n # Default: \"\"\n new-from-patch: path/to/patch/file\n # Show issues in any part of update files (requires new-from-rev or new-from-patch).\n # Default: false\n whole-files: true\n # Fix found issues (if it's supported by the linter).\n # Default: false\n fix: true\n", - "linters": "linters:\n # Default set of linters.\n # The value can be:\n # - `standard`: https://golangci-lint.run/docs/linters/#enabled-by-default\n # - `all`: enables all linters by default.\n # - `none`: disables all linters by default.\n # - `fast`: enables only linters considered as \"fast\" (`golangci-lint help linters --json | jq '[ .[] | select(.fast==true) ] | map(.name)'`).\n # Default: standard\n default: all\n # Enable specific linter.\n enable:\n - arangolint\n - asasalint\n - asciicheck\n - bidichk\n - bodyclose\n - canonicalheader\n - containedctx\n - contextcheck\n - copyloopvar\n - cyclop\n - decorder\n - depguard\n - dogsled\n - dupl\n - dupword\n - durationcheck\n - embeddedstructfieldcheck\n - err113\n - errcheck\n - errchkjson\n - errname\n - errorlint\n - exhaustive\n - exhaustruct\n - exptostd\n - fatcontext\n - forbidigo\n - forcetypeassert\n - funcorder\n - funlen\n - ginkgolinter\n - gocheckcompilerdirectives\n - gochecknoglobals\n - gochecknoinits\n - gochecksumtype\n - gocognit\n - goconst\n - gocritic\n - gocyclo\n - godot\n - godox\n - goheader\n - gomoddirectives\n - gomodguard\n - goprintffuncname\n - gosec\n - gosmopolitan\n - govet\n - grouper\n - iface\n - importas\n - inamedparam\n - ineffassign\n - interfacebloat\n - intrange\n - ireturn\n - lll\n - loggercheck\n - maintidx\n - makezero\n - mirror\n - misspell\n - mnd\n - musttag\n - nakedret\n - nestif\n - nilerr\n - nilnesserr\n - nilnil\n - nlreturn\n - noctx\n - noinlineerr\n - nolintlint\n - nonamedreturns\n - nosprintfhostport\n - paralleltest\n - perfsprint\n - prealloc\n - predeclared\n - promlinter\n - protogetter\n - reassign\n - recvcheck\n - revive\n - rowserrcheck\n - sloglint\n - spancheck\n - sqlclosecheck\n - staticcheck\n - tagalign\n - tagliatelle\n - testableexamples\n - testifylint\n - testpackage\n - thelper\n - tparallel\n - unconvert\n - unparam\n - unused\n - usestdlibvars\n - usetesting\n - varnamelen\n - wastedassign\n - whitespace\n - wrapcheck\n - wsl\n - wsl_v5\n - zerologlint\n # Disable specific linters.\n disable:\n - arangolint\n - asasalint\n - asciicheck\n - bidichk\n - bodyclose\n - canonicalheader\n - containedctx\n - contextcheck\n - copyloopvar\n - cyclop\n - decorder\n - depguard\n - dogsled\n - dupl\n - dupword\n - durationcheck\n - embeddedstructfieldcheck\n - err113\n - errcheck\n - errchkjson\n - errname\n - errorlint\n - exhaustive\n - exhaustruct\n - exptostd\n - fatcontext\n - forbidigo\n - forcetypeassert\n - funcorder\n - funlen\n - ginkgolinter\n - gocheckcompilerdirectives\n - gochecknoglobals\n - gochecknoinits\n - gochecksumtype\n - gocognit\n - goconst\n - gocritic\n - gocyclo\n - godot\n - godox\n - goheader\n - gomoddirectives\n - gomodguard\n - goprintffuncname\n - gosec\n - gosmopolitan\n - govet\n - grouper\n - iface\n - importas\n - inamedparam\n - ineffassign\n - interfacebloat\n - intrange\n - ireturn\n - lll\n - loggercheck\n - maintidx\n - makezero\n - mirror\n - misspell\n - mnd\n - musttag\n - nakedret\n - nestif\n - nilerr\n - nilnesserr\n - nilnil\n - nlreturn\n - noctx\n - noinlineerr\n - nolintlint\n - nonamedreturns\n - nosprintfhostport\n - paralleltest\n - perfsprint\n - prealloc\n - predeclared\n - promlinter\n - protogetter\n - reassign\n - recvcheck\n - revive\n - rowserrcheck\n - sloglint\n - spancheck\n - sqlclosecheck\n - staticcheck\n - tagalign\n - tagliatelle\n - testableexamples\n - testifylint\n - testpackage\n - thelper\n - tparallel\n - unconvert\n - unparam\n - unused\n - usestdlibvars\n - usetesting\n - varnamelen\n - wastedassign\n - whitespace\n - wrapcheck\n - wsl\n - wsl_v5\n - zerologlint\n # All available settings of specific linters.\n settings:\n # See the dedicated \"linters.settings\" documentation section.\n option: value\n # Defines a set of rules to ignore issues.\n # It does not skip the analysis, and so does not ignore \"typecheck\" errors.\n exclusions:\n # Mode of the generated files analysis.\n #\n # - `strict`: sources are excluded by strictly following the Go generated file convention.\n # Source files that have lines matching only the following regular expression will be excluded: `^// Code generated .* DO NOT EDIT\\.$`\n # This line must appear before the first non-comment, non-blank text in the file.\n # https://go.dev/s/generatedcode\n # - `lax`: sources are excluded if they contain lines like `autogenerated file`, `code generated`, `do not edit`, etc.\n # - `disable`: disable the generated files exclusion.\n #\n # Default: strict\n generated: lax\n # Log a warning if an exclusion rule is unused.\n # Default: false\n warn-unused: true\n # Predefined exclusion rules.\n # Default: []\n presets:\n - comments\n - std-error-handling\n - common-false-positives\n - legacy\n # Excluding configuration per-path, per-linter, per-text and per-source.\n rules:\n # Exclude some linters from running on tests files.\n - path: _test\\.go\n linters:\n - gocyclo\n - errcheck\n - dupl\n - gosec\n # Run some linter only for test files by excluding its issues for everything else.\n - path-except: _test\\.go\n linters:\n - forbidigo\n # Exclude known linters from partially hard-vendored code,\n # which is impossible to exclude via `nolint` comments.\n # `/` will be replaced by the current OS file path separator to properly work on Windows.\n - path: internal/hmac/\n text: \"weak cryptographic primitive\"\n linters:\n - gosec\n # Exclude some `staticcheck` messages.\n - linters:\n - staticcheck\n text: \"SA9003:\"\n # Exclude `lll` issues for long lines with `go:generate`.\n - linters:\n - lll\n source: \"^//go:generate \"\n # Which file paths to exclude: they will be analyzed, but issues from them won't be reported.\n # \"/\" will be replaced by the current OS file path separator to properly work on Windows.\n # Default: []\n paths:\n - \".*\\\\.my\\\\.go$\"\n - lib/bad.go\n # Which file paths to not exclude.\n # Default: []\n paths-except:\n - \".*\\\\.my\\\\.go$\"\n - lib/bad.go\n", + "linters": "linters:\n # Default set of linters.\n # The value can be:\n # - `standard`: https://golangci-lint.run/docs/linters/#enabled-by-default\n # - `all`: enables all linters by default.\n # - `none`: disables all linters by default.\n # - `fast`: enables only linters considered as \"fast\" (`golangci-lint help linters --json | jq '[ .[] | select(.fast==true) ] | map(.name)'`).\n # Default: standard\n default: all\n # Enable specific linter.\n enable:\n - arangolint\n - asasalint\n - asciicheck\n - bidichk\n - bodyclose\n - canonicalheader\n - containedctx\n - contextcheck\n - copyloopvar\n - cyclop\n - decorder\n - depguard\n - dogsled\n - dupl\n - dupword\n - durationcheck\n - embeddedstructfieldcheck\n - err113\n - errcheck\n - errchkjson\n - errname\n - errorlint\n - exhaustive\n - exhaustruct\n - exptostd\n - fatcontext\n - forbidigo\n - forcetypeassert\n - funcorder\n - funlen\n - ginkgolinter\n - gocheckcompilerdirectives\n - gochecknoglobals\n - gochecknoinits\n - gochecksumtype\n - gocognit\n - goconst\n - gocritic\n - gocyclo\n - godoclint\n - godot\n - godox\n - goheader\n - gomoddirectives\n - gomodguard\n - goprintffuncname\n - gosec\n - gosmopolitan\n - govet\n - grouper\n - iface\n - importas\n - inamedparam\n - ineffassign\n - interfacebloat\n - intrange\n - iotamixing\n - ireturn\n - lll\n - loggercheck\n - maintidx\n - makezero\n - mirror\n - misspell\n - mnd\n - modernize\n - musttag\n - nakedret\n - nestif\n - nilerr\n - nilnesserr\n - nilnil\n - nlreturn\n - noctx\n - noinlineerr\n - nolintlint\n - nonamedreturns\n - nosprintfhostport\n - paralleltest\n - perfsprint\n - prealloc\n - predeclared\n - promlinter\n - protogetter\n - reassign\n - recvcheck\n - revive\n - rowserrcheck\n - sloglint\n - spancheck\n - sqlclosecheck\n - staticcheck\n - tagalign\n - tagliatelle\n - testableexamples\n - testifylint\n - testpackage\n - thelper\n - tparallel\n - unconvert\n - unparam\n - unqueryvet\n - unused\n - usestdlibvars\n - usetesting\n - varnamelen\n - wastedassign\n - whitespace\n - wrapcheck\n - wsl\n - wsl_v5\n - zerologlint\n # Disable specific linters.\n disable:\n - arangolint\n - asasalint\n - asciicheck\n - bidichk\n - bodyclose\n - canonicalheader\n - containedctx\n - contextcheck\n - copyloopvar\n - cyclop\n - decorder\n - depguard\n - dogsled\n - dupl\n - dupword\n - durationcheck\n - embeddedstructfieldcheck\n - err113\n - errcheck\n - errchkjson\n - errname\n - errorlint\n - exhaustive\n - exhaustruct\n - exptostd\n - fatcontext\n - forbidigo\n - forcetypeassert\n - funcorder\n - funlen\n - ginkgolinter\n - gocheckcompilerdirectives\n - gochecknoglobals\n - gochecknoinits\n - gochecksumtype\n - gocognit\n - goconst\n - gocritic\n - gocyclo\n - godoclint\n - godot\n - godox\n - goheader\n - gomoddirectives\n - gomodguard\n - goprintffuncname\n - gosec\n - gosmopolitan\n - govet\n - grouper\n - iface\n - importas\n - inamedparam\n - ineffassign\n - interfacebloat\n - intrange\n - iotamixing\n - ireturn\n - lll\n - loggercheck\n - maintidx\n - makezero\n - mirror\n - misspell\n - mnd\n - modernize\n - musttag\n - nakedret\n - nestif\n - nilerr\n - nilnesserr\n - nilnil\n - nlreturn\n - noctx\n - noinlineerr\n - nolintlint\n - nonamedreturns\n - nosprintfhostport\n - paralleltest\n - perfsprint\n - prealloc\n - predeclared\n - promlinter\n - protogetter\n - reassign\n - recvcheck\n - revive\n - rowserrcheck\n - sloglint\n - spancheck\n - sqlclosecheck\n - staticcheck\n - tagalign\n - tagliatelle\n - testableexamples\n - testifylint\n - testpackage\n - thelper\n - tparallel\n - unconvert\n - unparam\n - unqueryvet\n - unused\n - usestdlibvars\n - usetesting\n - varnamelen\n - wastedassign\n - whitespace\n - wrapcheck\n - wsl\n - wsl_v5\n - zerologlint\n # All available settings of specific linters.\n settings:\n # See the dedicated \"linters.settings\" documentation section.\n option: value\n # Defines a set of rules to ignore issues.\n # It does not skip the analysis, and so does not ignore \"typecheck\" errors.\n exclusions:\n # Mode of the generated files analysis.\n #\n # - `strict`: sources are excluded by strictly following the Go generated file convention.\n # Source files that have lines matching only the following regular expression will be excluded: `^// Code generated .* DO NOT EDIT\\.$`\n # This line must appear before the first non-comment, non-blank text in the file.\n # https://go.dev/s/generatedcode\n # - `lax`: sources are excluded if they contain lines like `autogenerated file`, `code generated`, `do not edit`, etc.\n # - `disable`: disable the generated files exclusion.\n #\n # Default: strict\n generated: lax\n # Log a warning if an exclusion rule is unused.\n # Default: false\n warn-unused: true\n # Predefined exclusion rules.\n # Default: []\n presets:\n - comments\n - std-error-handling\n - common-false-positives\n - legacy\n # Excluding configuration per-path, per-linter, per-text and per-source.\n rules:\n # Exclude some linters from running on tests files.\n - path: _test\\.go\n linters:\n - gocyclo\n - errcheck\n - dupl\n - gosec\n # Run some linter only for test files by excluding its issues for everything else.\n - path-except: _test\\.go\n linters:\n - forbidigo\n # Exclude known linters from partially hard-vendored code,\n # which is impossible to exclude via `nolint` comments.\n # `/` will be replaced by the current OS file path separator to properly work on Windows.\n - path: internal/hmac/\n text: \"weak cryptographic primitive\"\n linters:\n - gosec\n # Exclude some `staticcheck` messages.\n - linters:\n - staticcheck\n text: \"SA9003:\"\n # Exclude `lll` issues for long lines with `go:generate`.\n - linters:\n - lll\n source: \"^//go:generate \"\n # Which file paths to exclude: they will be analyzed, but issues from them won't be reported.\n # \"/\" will be replaced by the current OS file path separator to properly work on Windows.\n # Default: []\n paths:\n - \".*\\\\.my\\\\.go$\"\n - lib/bad.go\n # Which file paths to not exclude.\n # Default: []\n paths-except:\n - \".*\\\\.my\\\\.go$\"\n - lib/bad.go\n", "output": "# Output configuration options.\noutput:\n # The formats used to render issues.\n formats:\n # Prints issues in a text format with colors, line number, and linter name.\n # This format is the default format.\n text:\n # Output path can be either `stdout`, `stderr` or path to the file to write to.\n # Default: stdout\n path: ./path/to/output.txt\n # Print linter name in the end of issue text.\n # Default: true\n print-linter-name: false\n # Print lines of code with issue.\n # Default: true\n print-issued-lines: false\n # Use colors.\n # Default: true\n colors: false\n # Prints issues in a JSON representation.\n json:\n # Output path can be either `stdout`, `stderr` or path to the file to write to.\n # Default: stdout\n path: ./path/to/output.json\n # Prints issues in columns representation separated by tabulations.\n tab:\n # Output path can be either `stdout`, `stderr` or path to the file to write to.\n # Default: stdout\n path: ./path/to/output.txt\n # Print linter name in the end of issue text.\n # Default: true\n print-linter-name: true\n # Use colors.\n # Default: true\n colors: false\n # Prints issues in an HTML page.\n # It uses the Cloudflare CDN (cdnjs) and React.\n html:\n # Output path can be either `stdout`, `stderr` or path to the file to write to.\n # Default: stdout\n path: ./path/to/output.html\n # Prints issues in the Checkstyle format.\n checkstyle:\n # Output path can be either `stdout`, `stderr` or path to the file to write to.\n # Default: stdout\n path: ./path/to/output.xml\n # Prints issues in the Code Climate format.\n code-climate:\n # Output path can be either `stdout`, `stderr` or path to the file to write to.\n # Default: stdout\n path: ./path/to/output.json\n # Prints issues in the JUnit XML format.\n junit-xml:\n # Output path can be either `stdout`, `stderr` or path to the file to write to.\n # Default: stdout\n path: ./path/to/output.xml\n # Support extra JUnit XML fields.\n # Default: false\n extended: true\n # Prints issues in the TeamCity format.\n teamcity:\n # Output path can be either `stdout`, `stderr` or path to the file to write to.\n # Default: stdout\n path: ./path/to/output.txt\n # Prints issues in the SARIF format.\n sarif:\n # Output path can be either `stdout`, `stderr` or path to the file to write to.\n # Default: stdout\n path: ./path/to/output.json\n # Add a prefix to the output file references.\n # This option is ignored when using `output.path-mode: abs` mode.\n # Default: \"\"\n path-prefix: \"\"\n # By default, the report are related to the path obtained by `run.relative-path-mode`.\n # The mode `abs` allows to show absolute file paths instead of relative file paths.\n # The option `output.path-prefix` is ignored when using `abs` mode.\n # Default: \"\"\n path-mode: \"abs\"\n # Order to use when sorting results.\n # Possible values: `file`, `linter`, and `severity`.\n #\n # If the severity values are inside the following list, they are ordered in this order:\n # 1. error\n # 2. warning\n # 3. high\n # 4. medium\n # 5. low\n # Either they are sorted alphabetically.\n #\n # Default: [\"linter\", \"file\"]\n sort-order:\n - linter\n - severity\n - file # filepath, line, and column.\n # Show statistics per linter.\n # Default: true\n show-stats: false\n", "root": "# See the dedicated \"version\" documentation section.\nversion: \"2\"\nlinters:\n # See the dedicated \"linters\" documentation section.\n option: value\nformatters:\n # See the dedicated \"formatters\" documentation section.\n option: value\nissues:\n # See the dedicated \"issues\" documentation section.\n option: value\n# Output configuration options.\noutput:\n # See the dedicated \"output\" documentation section.\n option: value\n# Options for analysis running.\nrun:\n # See the dedicated \"run\" documentation section.\n option: value\nseverity:\n # See the dedicated \"severity\" documentation section.\n option: value\n", "run": "# Options for analysis running.\nrun:\n # Timeout for total work, e.g. 30s, 5m, 5m30s.\n # If the value is lower or equal to 0, the timeout is disabled.\n # Default: 0 (disabled)\n timeout: 5m\n # The mode used to evaluate relative paths.\n # It's used by exclusions, Go plugins, and some linters.\n # The value can be:\n # - `gomod`: the paths will be relative to the directory of the `go.mod` file.\n # - `gitroot`: the paths will be relative to the git root (the parent directory of `.git`).\n # - `cfg`: the paths will be relative to the configuration file.\n # - `wd` (NOT recommended): the paths will be relative to the place where golangci-lint is run.\n # Default: cfg\n relative-path-mode: gomod\n # Exit code when at least one issue was found.\n # Default: 1\n issues-exit-code: 2\n # Include test files or not.\n # Default: true\n tests: false\n # List of build tags, all linters use it.\n # Default: []\n build-tags:\n - mytag\n # If set, we pass it to \"go list -mod={option}\". From \"go help modules\":\n # If invoked with -mod=readonly, the go command is disallowed from the implicit\n # automatic updating of go.mod described above. Instead, it fails when any changes\n # to go.mod are needed. This setting is most useful to check that go.mod does\n # not need updates, such as in a continuous integration and testing system.\n # If invoked with -mod=vendor, the go command assumes that the vendor\n # directory holds the correct copies of dependencies and ignores\n # the dependency descriptions in go.mod.\n #\n # Allowed values: readonly|vendor|mod\n # Default: \"\"\n modules-download-mode: readonly\n # Allow multiple parallel golangci-lint instances running.\n # If false, golangci-lint acquires file lock on start.\n # Default: false\n allow-parallel-runners: true\n # Allow multiple golangci-lint instances running, but serialize them around a lock.\n # If false, golangci-lint exits with an error if it fails to acquire file lock on start.\n # Default: false\n allow-serial-runners: true\n # Define the Go version limit.\n # Default: use Go version from the go.mod file, fallback on the env var `GOVERSION`, fallback on 1.22.\n go: '1.23'\n # Number of operating system threads (`GOMAXPROCS`) that can execute golangci-lint simultaneously.\n # Default: 0 (automatically set to match Linux container CPU quota and\n # fall back to the number of logical CPUs in the machine)\n concurrency: 4\n", diff --git a/docs/data/linters_info.json b/docs/data/linters_info.json index 33d3723e2cf8..cfa0bfcdb467 100644 --- a/docs/data/linters_info.json +++ b/docs/data/linters_info.json @@ -408,6 +408,15 @@ "isSlow": false, "since": "v1.22.0" }, + { + "name": "modernize", + "desc": "A suite of analyzers that suggest simplifications to Go code, using modern language and library features.", + "loadMode": 8767, + "originalURL": "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/modernize", + "internal": false, + "isSlow": true, + "since": "v2.6.0" + }, { "name": "gomoddirectives", "desc": "Manage the use of 'replace', 'retract', and 'excludes' directives in go.mod.", diff --git a/docs/data/thanks.json b/docs/data/thanks.json index fc7d34dc2d92..4e012aa1679e 100644 --- a/docs/data/thanks.json +++ b/docs/data/thanks.json @@ -263,6 +263,7 @@ "linters": [ "gofmt", "goimports", + "modernize", "govet" ], "profile": "https://github.com/sponsors/golang", diff --git a/jsonschema/golangci.jsonschema.json b/jsonschema/golangci.jsonschema.json index f471fd3dadff..a2cf0fd963d0 100644 --- a/jsonschema/golangci.jsonschema.json +++ b/jsonschema/golangci.jsonschema.json @@ -32,6 +32,7 @@ "dupBranchBody", "dupCase", "dupImport", + "dupOption", "dupSubExpr", "dynamicFmtString", "elseif", @@ -53,7 +54,6 @@ "importShadow", "indexAlloc", "initClause", - "ioutilDeprecated", "mapKey", "methodExprCall", "nestingReduce", @@ -110,7 +110,8 @@ "weakCond", "whyNoLint", "wrapperFunc", - "yodaStyleExpr" + "yodaStyleExpr", + "zeroByteRepeat" ] }, "gocritic-tags": { @@ -706,6 +707,28 @@ "header" ] }, + "modernize-analyzers": { + "enum": [ + "any", + "bloop", + "fmtappendf", + "forvar", + "mapsloop", + "minmax", + "newexpr", + "omitzero", + "rangeint", + "reflecttypefor", + "slicescontains", + "slicessort", + "stditerators", + "stringscutprefix", + "stringsseq", + "stringsbuilder", + "testingcontext", + "waitgroup" + ] + }, "wsl-checks": { "enum": [ "assign", @@ -835,6 +858,7 @@ "mirror", "misspell", "mnd", + "modernize", "musttag", "nakedret", "nestif", @@ -921,6 +945,11 @@ "type": "string", "examples": ["0C0C"] } + }, + "comments-only": { + "description": "Checks only comments, skip strings.", + "type": "boolean", + "default": false } } }, @@ -2829,6 +2858,19 @@ } } }, + "modernizeSettings": { + "type": "object", + "additionalProperties": false, + "properties": { + "disable": { + "description": "List of analyzers to disable.", + "type": "array", + "items": { + "$ref": "#/definitions/modernize-analyzers" + } + } + } + }, "nolintlintSettings": { "type": "object", "additionalProperties": false, @@ -2968,6 +3010,16 @@ "description": "Enable/disable optimization of hex formatting.", "type": "boolean", "default": true + }, + "concat-loop": { + "description": "Enable/disable optimization of concat loop.", + "type": "boolean", + "default": true + }, + "loop-other-ops": { + "description": "Optimization of `concat-loop` even with other operations.", + "type": "boolean", + "default": false } } }, @@ -4747,6 +4799,9 @@ "mnd": { "$ref": "#/definitions/settings/definitions/mndSettings" }, + "modernize": { + "$ref": "#/definitions/settings/definitions/modernizeSettings" + }, "nolintlint":{ "$ref": "#/definitions/settings/definitions/nolintlintSettings" },