docs: update documentation assets (#4692)

Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
This commit is contained in:
golangci-releaser 2024-05-03 22:38:54 +03:00 committed by GitHub
parent ab1bd9449a
commit 620a72cfa3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 484 additions and 390 deletions

View File

@ -61,15 +61,6 @@ jobs:
- name: Update GitHub Action config - name: Update GitHub Action config
run: make assets/github-action-config.json run: make assets/github-action-config.json
- name: Update reference files
run: cp .golangci.next.reference.yml .golangci.reference.yml
- name: Update JSON schema files
run: cp jsonschema/golangci.next.jsonschema.json jsonschema/golangci.jsonschema.json
- name: Update information
run: make website_dump_info
- name: Create Pull Request - name: Create Pull Request
uses: peter-evans/create-pull-request@v6 uses: peter-evans/create-pull-request@v6
with: with:

View File

@ -154,9 +154,9 @@ linters-settings:
pop-directional-isolate: false pop-directional-isolate: false
copyloopvar: copyloopvar:
# If true, ignore aliasing of loop variables. # Check all assigning the loop variable to another variable.
# Default: false # Default: false
ignore-alias: true check-alias: true
cyclop: cyclop:
# The maximal code complexity to report. # The maximal code complexity to report.
@ -279,23 +279,11 @@ linters-settings:
# Default: false # Default: false
check-blank: true check-blank: true
# DEPRECATED comma-separated list of pairs of the form pkg:regex
#
# the regex is used to ignore names within pkg. (default "fmt:.*").
# see https://github.com/kisielk/errcheck#the-deprecated-method for details
ignore: fmt:.*,io/ioutil:^Read.*
# To disable the errcheck built-in exclude list. # To disable the errcheck built-in exclude list.
# See `-excludeonly` option in https://github.com/kisielk/errcheck#excluding-functions for details. # See `-excludeonly` option in https://github.com/kisielk/errcheck#excluding-functions for details.
# Default: false # Default: false
disable-default-exclusions: true disable-default-exclusions: true
# DEPRECATED use exclude-functions instead.
#
# Path to a file containing a list of functions to exclude from checking.
# See https://github.com/kisielk/errcheck#excluding-functions for details.
exclude: /path/to/file.txt
# List of functions to exclude from checking, where each entry is a single function to exclude. # List of functions to exclude from checking, where each entry is a single function to exclude.
# See https://github.com/kisielk/errcheck#excluding-functions for details. # See https://github.com/kisielk/errcheck#excluding-functions for details.
exclude-functions: exclude-functions:
@ -338,6 +326,16 @@ linters-settings:
# Check for plain error comparisons. # Check for plain error comparisons.
# Default: true # Default: true
comparison: false comparison: false
# Allowed errors.
# Default: []
allowed-errors:
- err: "io.EOF"
fun: "example.com/pkg.Read"
# Allowed error "wildcards".
# Default: []
allowed-errors-wildcard:
- err: "example.com/pkg.ErrMagic"
fun: "example.com/pkg.Magic"
exhaustive: exhaustive:
# Program elements to check for exhaustiveness. # Program elements to check for exhaustiveness.
@ -431,12 +429,9 @@ linters-settings:
ignore-comments: true ignore-comments: true
gci: gci:
# DEPRECATED: use `sections` and `prefix(github.com/org/project)` instead.
local-prefixes: github.com/org/project
# Section configuration to compare against. # Section configuration to compare against.
# Section names are case-insensitive and may contain parameters in (). # Section names are case-insensitive and may contain parameters in ().
# The default order of sections is `standard > default > custom > blank > dot > alias`, # The default order of sections is `standard > default > custom > blank > dot > alias > localmodule`,
# If `custom-order` is `true`, it follows the order of `sections` option. # If `custom-order` is `true`, it follows the order of `sections` option.
# Default: ["standard", "default"] # Default: ["standard", "default"]
sections: sections:
@ -446,6 +441,7 @@ linters-settings:
- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled. - blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
- dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled. - dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
- alias # Alias section: contains all alias imports. This section is not present unless explicitly enabled. - alias # Alias section: contains all alias imports. This section is not present unless explicitly enabled.
- localmodule # Local module section: contains all local packages. This section is not present unless explicitly enabled.
# Skip generated files. # Skip generated files.
# Default: true # Default: true
@ -636,9 +632,6 @@ linters-settings:
# The option is passed to the ruleguard 'debug-group' argument. # The option is passed to the ruleguard 'debug-group' argument.
# Default: "" # Default: ""
debug: 'emptyDecl' debug: 'emptyDecl'
# Deprecated, use 'failOn' param.
# If set to true, identical to failOn='all', otherwise failOn=''
failOnError: false
# Determines the behavior when an error occurs while parsing ruleguard files. # Determines the behavior when an error occurs while parsing ruleguard files.
# If flag is not set, log error and skip rule files that contain an error. # If flag is not set, log error and skip rule files that contain an error.
# If flag is set, the value must be a comma-separated list of error conditions. # If flag is set, the value must be a comma-separated list of error conditions.
@ -646,7 +639,7 @@ linters-settings:
# - 'import': ruleguard rule imports a package that cannot be found. # - 'import': ruleguard rule imports a package that cannot be found.
# - 'dsl': gorule file does not comply with the ruleguard DSL. # - 'dsl': gorule file does not comply with the ruleguard DSL.
# Default: "" # Default: ""
failOn: dsl failOn: dsl,import
# Comma-separated list of file paths containing ruleguard rules. # Comma-separated list of file paths containing ruleguard rules.
# If a path is relative, it is relative to the directory where the golangci-lint command is executed. # If a path is relative, it is relative to the directory where the golangci-lint command is executed.
# The special '${configDir}' variable is substituted with the absolute directory containing the golangci config file. # The special '${configDir}' variable is substituted with the absolute directory containing the golangci config file.
@ -723,9 +716,6 @@ linters-settings:
replacement: 'a[b:]' replacement: 'a[b:]'
gofumpt: gofumpt:
# Deprecated: use the global `run.go` instead.
lang-version: "1.17"
# Module path which contains the source code being formatted. # Module path which contains the source code being formatted.
# Default: "" # Default: ""
module-path: github.com/org/project module-path: github.com/org/project
@ -779,38 +769,6 @@ linters-settings:
# Default: "" # Default: ""
local-prefixes: github.com/org/project local-prefixes: github.com/org/project
gomnd:
# List of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description.
# Default: ["argument", "case", "condition", "operation", "return", "assign"]
checks:
- argument
- case
- condition
- operation
- return
- assign
# List of numbers to exclude from analysis.
# The numbers should be written as string.
# Values always ignored: "1", "1.0", "0" and "0.0"
# Default: []
ignored-numbers:
- '0666'
- '0755'
- '42'
# List of file patterns to exclude from analysis.
# Values always ignored: `.+_test.go`
# Default: []
ignored-files:
- 'magic1_.+\.go$'
# List of function patterns to exclude from analysis.
# Following functions are always ignored: `time.Date`,
# `strconv.FormatInt`, `strconv.FormatUint`, `strconv.FormatFloat`,
# `strconv.ParseInt`, `strconv.ParseUint`, `strconv.ParseFloat`.
# Default: []
ignored-functions:
- '^math\.'
- '^http\.StatusText$'
gomoddirectives: gomoddirectives:
# Allow local `replace` directives. # Allow local `replace` directives.
# Default: false # Default: false
@ -861,8 +819,6 @@ linters-settings:
local_replace_directives: false local_replace_directives: false
gosimple: gosimple:
# Deprecated: use the global `run.go` instead.
go: "1.15"
# Sxxxx checks in https://staticcheck.io/docs/configuration/options/#checks # Sxxxx checks in https://staticcheck.io/docs/configuration/options/#checks
# Default: ["*"] # Default: ["*"]
checks: [ "all" ] checks: [ "all" ]
@ -1367,6 +1323,38 @@ linters-settings:
# Default: "" # Default: ""
mode: restricted mode: restricted
mnd:
# List of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description.
# Default: ["argument", "case", "condition", "operation", "return", "assign"]
checks:
- argument
- case
- condition
- operation
- return
- assign
# List of numbers to exclude from analysis.
# The numbers should be written as string.
# Values always ignored: "1", "1.0", "0" and "0.0"
# Default: []
ignored-numbers:
- '0666'
- '0755'
- '42'
# List of file patterns to exclude from analysis.
# Values always ignored: `.+_test.go`
# Default: []
ignored-files:
- 'magic1_.+\.go$'
# List of function patterns to exclude from analysis.
# Following functions are always ignored: `time.Date`,
# `strconv.FormatInt`, `strconv.FormatUint`, `strconv.FormatFloat`,
# `strconv.ParseInt`, `strconv.ParseUint`, `strconv.ParseFloat`.
# Default: []
ignored-functions:
- '^math\.'
- '^http\.StatusText$'
musttag: musttag:
# A set of custom functions to check in addition to the builtin ones. # 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 # Default: json, xml, gopkg.in/yaml.v3, BurntSushi/toml, mitchellh/mapstructure, jmoiron/sqlx
@ -2013,8 +2001,12 @@ linters-settings:
# Default: "" # Default: ""
no-global: "all" no-global: "all"
# Enforce using methods that accept a context. # Enforce using methods that accept a context.
# Default: false # Values:
context-only: true # - "": disabled
# - "all": report all contextless calls
# - "scope": report only if a context exists in the scope of the outermost function
# Default: ""
context: "all"
# Enforce using static values for log messages. # Enforce using static values for log messages.
# Default: false # Default: false
static-msg: true static-msg: true
@ -2046,17 +2038,19 @@ linters-settings:
# Default: [] # Default: []
ignore-check-signatures: ignore-check-signatures:
- "telemetry.RecordError" - "telemetry.RecordError"
# A list of regexes for additional function signatures that create spans.
# This is useful if you have a utility method to create spans.
# Each entry should be of the form `<regex>:<telemetry-type>`, where `telemetry-type` can be `opentelemetry` or `opencensus`.
# https://github.com/jjti/go-spancheck#extra-start-span-signatures
# Default: []
extra-start-span-signatures:
- "github.com/user/repo/telemetry/trace.Start:opentelemetry"
staticcheck: staticcheck:
# Deprecated: use the global `run.go` instead.
go: "1.15"
# SAxxxx checks in https://staticcheck.io/docs/configuration/options/#checks # SAxxxx checks in https://staticcheck.io/docs/configuration/options/#checks
# Default: ["*"] # Default: ["*"]
checks: [ "all" ] checks: [ "all" ]
stylecheck: stylecheck:
# Deprecated: use the global `run.go` instead.
go: "1.15"
# STxxxx checks in https://staticcheck.io/docs/configuration/options/#checks # STxxxx checks in https://staticcheck.io/docs/configuration/options/#checks
# Default: ["*"] # Default: ["*"]
checks: [ "all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022" ] checks: [ "all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022" ]
@ -2280,9 +2274,6 @@ linters-settings:
# Suggest the use of rpc.DefaultXXPath. # Suggest the use of rpc.DefaultXXPath.
# Default: false # Default: false
default-rpc-path: true default-rpc-path: true
# DEPRECATED Suggest the use of os.DevNull.
# Default: false
os-dev-null: true
# Suggest the use of sql.LevelXX.String(). # Suggest the use of sql.LevelXX.String().
# Default: false # Default: false
sql-isolation-level: true sql-isolation-level: true
@ -2292,9 +2283,6 @@ linters-settings:
# Suggest the use of constant.Kind.String(). # Suggest the use of constant.Kind.String().
# Default: false # Default: false
constant-kind: true constant-kind: true
# DEPRECATED Suggest the use of syslog.Priority.
# Default: false
syslog-priority: true
unconvert: unconvert:
# Remove conversions that force intermediate rounding. # Remove conversions that force intermediate rounding.
@ -2514,6 +2502,7 @@ linters:
- asciicheck - asciicheck
- bidichk - bidichk
- bodyclose - bodyclose
- canonicalheader
- containedctx - containedctx
- contextcheck - contextcheck
- copyloopvar - copyloopvar
@ -2524,6 +2513,7 @@ linters:
- dupl - dupl
- dupword - dupword
- durationcheck - durationcheck
- err113
- errcheck - errcheck
- errchkjson - errchkjson
- errname - errname
@ -2532,6 +2522,7 @@ linters:
- exhaustive - exhaustive
- exhaustruct - exhaustruct
- exportloopref - exportloopref
- fatcontext
- forbidigo - forbidigo
- forcetypeassert - forcetypeassert
- funlen - funlen
@ -2547,12 +2538,10 @@ linters:
- gocyclo - gocyclo
- godot - godot
- godox - godox
- goerr113
- gofmt - gofmt
- gofumpt - gofumpt
- goheader - goheader
- goimports - goimports
- gomnd
- gomoddirectives - gomoddirectives
- gomodguard - gomodguard
- goprintffuncname - goprintffuncname
@ -2573,6 +2562,7 @@ linters:
- makezero - makezero
- mirror - mirror
- misspell - misspell
- mnd
- musttag - musttag
- nakedret - nakedret
- nestif - nestif
@ -2627,6 +2617,7 @@ linters:
- asciicheck - asciicheck
- bidichk - bidichk
- bodyclose - bodyclose
- canonicalheader
- containedctx - containedctx
- contextcheck - contextcheck
- copyloopvar - copyloopvar
@ -2637,6 +2628,7 @@ linters:
- dupl - dupl
- dupword - dupword
- durationcheck - durationcheck
- err113
- errcheck - errcheck
- errchkjson - errchkjson
- errname - errname
@ -2645,6 +2637,7 @@ linters:
- exhaustive - exhaustive
- exhaustruct - exhaustruct
- exportloopref - exportloopref
- fatcontext
- forbidigo - forbidigo
- forcetypeassert - forcetypeassert
- funlen - funlen
@ -2660,12 +2653,10 @@ linters:
- gocyclo - gocyclo
- godot - godot
- godox - godox
- goerr113
- gofmt - gofmt
- gofumpt - gofumpt
- goheader - goheader
- goimports - goimports
- gomnd
- gomoddirectives - gomoddirectives
- gomodguard - gomodguard
- goprintffuncname - goprintffuncname
@ -2686,6 +2677,7 @@ linters:
- makezero - makezero
- mirror - mirror
- misspell - misspell
- mnd
- musttag - musttag
- nakedret - nakedret
- nestif - nestif
@ -2735,6 +2727,7 @@ linters:
- ifshort # Deprecated - ifshort # Deprecated
- interfacer # Deprecated - interfacer # Deprecated
- maligned # Deprecated - maligned # Deprecated
- gomnd # Deprecated
- nosnakecase # Deprecated - nosnakecase # Deprecated
- scopelint # Deprecated - scopelint # Deprecated
- structcheck # Deprecated - structcheck # Deprecated

View File

@ -57,7 +57,7 @@ linters-settings:
replacement: 'any' replacement: 'any'
goimports: goimports:
local-prefixes: github.com/golangci/golangci-lint local-prefixes: github.com/golangci/golangci-lint
gomnd: mnd:
# don't include the "operation" and "assign" # don't include the "operation" and "assign"
checks: checks:
- argument - argument
@ -121,7 +121,7 @@ linters:
- godox - godox
- gofmt - gofmt
- goimports - goimports
- gomnd - mnd
- goprintffuncname - goprintffuncname
- gosec - gosec
- gosimple - gosimple
@ -150,7 +150,7 @@ issues:
- path: (.+)_test\.go - path: (.+)_test\.go
linters: linters:
- dupl - dupl
- gomnd - mnd
- lll - lll
# The logic of creating a linter is similar between linters, it's not duplication. # The logic of creating a linter is similar between linters, it's not duplication.

View File

@ -2,6 +2,65 @@ Follow the news and releases on [Mastodon](https://fosstodon.org/@golangcilint)
There is the most valuable changes log: There is the most valuable changes log:
### v1.58.0
1. New linters
* `fatcontext`: https://github.com/Crocmagnon/fatcontext
* `canonicalheader`: https://github.com/lasiar/canonicalheader
2. Updated linters
* `copyloopvar`: from 1.0.10 to 1.1.0 (`ignore-alias` is replaced by `check-alias` with the opposite behavior)
* `decorder`: from 0.4.1 to 0.4.2
* `errname`: from 0.1.12 to 0.1.13
* `errorlint`: from 1.4.8 to 1.5.1 (new options `allowed-errors` and `allowed-errors-wildcard`)
* `execinquery`: deprecate linter ⚠️
* `gci`: from 0.12.3 to 0.13.4 (new section `localModule`)
* `gocritic`: from 0.11.2 to 0.11.3
* `spancheck`: from 0.5.3 to 0.6.1
* `goerr113` is replaced by `err113` ⚠️
* `gomnd` is replaced by `mnd` ⚠️
* `gomodguard`: from 1.3.1 to 1.3.2
* `grouper`: from 1.1.1 to 1.1.2
* `intrange`: from 0.1.1 to 0.1.2
* `mirror`: from 1.1.0 to 1.2.0
* `misspell`: from 0.4.1 to 0.5.1
* `musttag`: from 0.9.0 to 0.12.1
* `nilnil`: from 0.1.7 to 0.1.8
* `nonamedreturns`: from 1.0.4 to 1.0.5
* `promlinter`: from 0.2.0 to 0.3.0
* `sloglint`: from 0.5.0 to 0.6.0
* `unparam`: bump to HEAD (063aff900ca150b80930c8de76f11d7e6488222f)
* `whitespace`: from 0.1.0 to 0.1.1
3. Enhancements
* Speed up "fast" linters when only "fast" linters are run: between 40% and 80% faster at first run (i.e. without cache)
4. Fixes
* Use version with module plugins
* Skip `go.mod` report inside autogenerated processor
* Keep only `typecheck` issues when needed
* Don't hide `typecheck` errors inside diff processor
5. Misc.
* ⚠️ log an error when using previously deprecated linters ([Linter Deprecation Cycle](https://golangci-lint.run/product/roadmap/#linter-deprecation-cycle))
* [`deadcode`](https://github.com/remyoudompheng/go-misc/tree/master/deadcode): deprecated since v1.49.0 (2022-08-23).
* [`exhaustivestruct`](https://github.com/mbilski/exhaustivestruct): deprecated since v1.46.0 (2022-05-08).
* [`golint`](https://github.com/golang/lint): deprecated since v1.41.0 (2021-06-15).
* [`ifshort`](https://github.com/esimonov/ifshort): deprecated since v1.48.0 (2022-08-04).
* [`interfacer`](https://github.com/mvdan/interfacer): deprecated since v1.38.0 (2021-03-03).
* [`maligned`](https://github.com/mdempsky/maligned): deprecated since v1.38.0 (2021-03-03).
* [`nosnakecase`](https://github.com/sivchari/nosnakecase): deprecated since v1.48.0 (2022-08-04).
* [`scopelint`](https://github.com/kyoh86/scopelint): deprecated since v1.39.0 (2021-03-25).
* [`structcheck`](https://github.com/opennota/check): deprecated since v1.49.0 (2022-08-23).
* [`varcheck`](https://github.com/opennota/check): deprecated since v1.49.0 (2022-08-23).
* ⚠️ Deprecate usage of linter alternative names
* Remove help display on errors with `config verify` command
* Add `pre-commit` hook to run `config verify`
* Improve `github-action` output
6. Documentation
* docs: remove deprecated Atom from Editor Integrations
GitHub Action (v5.1.0) for golangci-lint:
- supports for `pull`, `pull_request_target`, and `merge_group` events with the option `only-new-issues`.
- ️️⚠️ `skip-pkg-cache` and `skip-build-cache` have been removed because the cache related to Go itself is already handled by `actions/setup-go`.
- with golangci-lint v1.58, the file information (path and position) will be displayed on the log.
### v1.57.2 ### v1.57.2
1. Updated linters 1. Updated linters
@ -12,16 +71,16 @@ There is the most valuable changes log:
* `gomoddirectives`: from 0.2.3 to 0.2.4 * `gomoddirectives`: from 0.2.3 to 0.2.4
* `intrange`: from 0.1.0 to 0.1.1 * `intrange`: from 0.1.0 to 0.1.1
2. Misc. 2. Misc.
* fix: display warnings on deprecated linter options * Display warnings on deprecated linter options
* fix: missing `colored-tab` output format * Fix missing `colored-tab` output format
* fix: TeamCity `inspectionType` service message * Fix TeamCity `inspectionType` service message
3. Documentation 3. Documentation
* Remove invalid example about mixing files and directory * Remove invalid example about mixing files and directory
* Improve linters page * Improve linters page
### v1.57.1 ### v1.57.1
1. Fixes: 1. Fixes
* Ignore issues with invalid position (e.g. `contextcheck`). * Ignore issues with invalid position (e.g. `contextcheck`).
### v1.57.0 ### v1.57.0
@ -57,7 +116,7 @@ There is the most valuable changes log:
* 🎉 Allow running only a specific linter without modifying the file configuration (`--enable-only`) * 🎉 Allow running only a specific linter without modifying the file configuration (`--enable-only`)
* Allow custom sort order for the reports (`output.sort-order`) * Allow custom sort order for the reports (`output.sort-order`)
* Automatically adjust the maximum concurrency to the container CPU quota if `run.concurrency=0` * Automatically adjust the maximum concurrency to the container CPU quota if `run.concurrency=0`
* Add `verify` command to check the configuration against the JSON Schema * Add `config verify` command to check the configuration against the JSON Schema
* Option to strictly follow Go generated file convention (`issues.exclude-generated-strict`) * Option to strictly follow Go generated file convention (`issues.exclude-generated-strict`)
* Syntax to not override `severity` from linters (`@linter`) * Syntax to not override `severity` from linters (`@linter`)
* Use severities from `gosec` * Use severities from `gosec`

File diff suppressed because one or more lines are too long

View File

@ -3,90 +3,90 @@
"id": "EXC0001", "id": "EXC0001",
"pattern": "Error return value of .((os\\.)?std(out|err)\\..*|.*Close|.*Flush|os\\.Remove(All)?|.*print(f|ln)?|os\\.(Un)?Setenv). is not checked", "pattern": "Error return value of .((os\\.)?std(out|err)\\..*|.*Close|.*Flush|os\\.Remove(All)?|.*print(f|ln)?|os\\.(Un)?Setenv). is not checked",
"linter": "errcheck", "linter": "errcheck",
"why": "Almost all programs ignore errors on these functions and in most cases it's ok" "why": "Almost all programs ignore errors on these functions and in most cases it's ok."
}, },
{ {
"id": "EXC0002", "id": "EXC0002",
"pattern": "(comment on exported (method|function|type|const)|should have( a package)? comment|comment should be of the form)", "pattern": "(comment on exported (method|function|type|const)|should have( a package)? comment|comment should be of the form)",
"linter": "golint", "linter": "golint",
"why": "Annoying issue about not having a comment. The rare codebase has such comments" "why": "Annoying issue about not having a comment. The rare codebase has such comments."
}, },
{ {
"id": "EXC0003", "id": "EXC0003",
"pattern": "func name will be used as test\\.Test.* by other packages, and that stutters; consider calling this", "pattern": "func name will be used as test\\.Test.* by other packages, and that stutters; consider calling this",
"linter": "golint", "linter": "golint",
"why": "False positive when tests are defined in package 'test'" "why": "False positive when tests are defined in package 'test'."
}, },
{ {
"id": "EXC0004", "id": "EXC0004",
"pattern": "(possible misuse of unsafe.Pointer|should have signature)", "pattern": "(possible misuse of unsafe.Pointer|should have signature)",
"linter": "govet", "linter": "govet",
"why": "Common false positives" "why": "Common false positives."
}, },
{ {
"id": "EXC0005", "id": "EXC0005",
"pattern": "ineffective break statement. Did you mean to break out of the outer loop", "pattern": "SA4011",
"linter": "staticcheck", "linter": "staticcheck",
"why": "Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore" "why": "Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore."
}, },
{ {
"id": "EXC0006", "id": "EXC0006",
"pattern": "Use of unsafe calls should be audited", "pattern": "G103: Use of unsafe calls should be audited",
"linter": "gosec", "linter": "gosec",
"why": "Too many false-positives on 'unsafe' usage" "why": "Too many false-positives on 'unsafe' usage."
}, },
{ {
"id": "EXC0007", "id": "EXC0007",
"pattern": "Subprocess launch(ed with variable|ing should be audited)", "pattern": "G204: Subprocess launched with variable",
"linter": "gosec", "linter": "gosec",
"why": "Too many false-positives for parametrized shell calls" "why": "Too many false-positives for parametrized shell calls."
}, },
{ {
"id": "EXC0008", "id": "EXC0008",
"pattern": "(G104)", "pattern": "G104",
"linter": "gosec", "linter": "gosec",
"why": "Duplicated errcheck checks" "why": "Duplicated errcheck checks."
}, },
{ {
"id": "EXC0009", "id": "EXC0009",
"pattern": "(Expect directory permissions to be 0750 or less|Expect file permissions to be 0600 or less)", "pattern": "(G301|G302|G307): Expect (directory permissions to be 0750|file permissions to be 0600) or less",
"linter": "gosec", "linter": "gosec",
"why": "Too many issues in popular repos" "why": "Too many issues in popular repos."
}, },
{ {
"id": "EXC0010", "id": "EXC0010",
"pattern": "Potential file inclusion via variable", "pattern": "G304: Potential file inclusion via variable",
"linter": "gosec", "linter": "gosec",
"why": "False positive is triggered by 'src, err := ioutil.ReadFile(filename)'" "why": "False positive is triggered by 'src, err := ioutil.ReadFile(filename)'."
}, },
{ {
"id": "EXC0011", "id": "EXC0011",
"pattern": "(comment on exported (method|function|type|const)|should have( a package)? comment|comment should be of the form)", "pattern": "(ST1000|ST1020|ST1021|ST1022)",
"linter": "stylecheck", "linter": "stylecheck",
"why": "Annoying issue about not having a comment. The rare codebase has such comments" "why": "Annoying issue about not having a comment. The rare codebase has such comments."
}, },
{ {
"id": "EXC0012", "id": "EXC0012",
"pattern": "exported (.+) should have comment( \\(or a comment on this block\\))? or be unexported", "pattern": "exported (.+) should have comment( \\(or a comment on this block\\))? or be unexported",
"linter": "revive", "linter": "revive",
"why": "Annoying issue about not having a comment. The rare codebase has such comments" "why": "Annoying issue about not having a comment. The rare codebase has such comments."
}, },
{ {
"id": "EXC0013", "id": "EXC0013",
"pattern": "package comment should be of the form \"(.+)...", "pattern": "package comment should be of the form \"(.+)...\"",
"linter": "revive", "linter": "revive",
"why": "Annoying issue about not having a comment. The rare codebase has such comments" "why": "Annoying issue about not having a comment. The rare codebase has such comments."
}, },
{ {
"id": "EXC0014", "id": "EXC0014",
"pattern": "comment on exported (.+) should be of the form \"(.+)...\"", "pattern": "comment on exported (.+) should be of the form \"(.+)...\"",
"linter": "revive", "linter": "revive",
"why": "Annoying issue about not having a comment. The rare codebase has such comments" "why": "Annoying issue about not having a comment. The rare codebase has such comments."
}, },
{ {
"id": "EXC0015", "id": "EXC0015",
"pattern": "should have a package comment", "pattern": "should have a package comment",
"linter": "revive", "linter": "revive",
"why": "Annoying issue about not having a comment. The rare codebase has such comments" "why": "Annoying issue about not having a comment. The rare codebase has such comments."
} }
] ]

View File

@ -49,6 +49,18 @@
"isSlow": true, "isSlow": true,
"since": "v1.18.0" "since": "v1.18.0"
}, },
{
"name": "canonicalheader",
"desc": "canonicalheader checks whether net/http.Header uses canonical header",
"loadMode": 575,
"inPresets": [
"style"
],
"originalURL": "https://github.com/lasiar/canonicalHeader",
"internal": false,
"isSlow": true,
"since": "v1.58.0"
},
{ {
"name": "containedctx", "name": "containedctx",
"desc": "containedctx is a linter that detects struct contained context.Context field", "desc": "containedctx is a linter that detects struct contained context.Context field",
@ -110,23 +122,6 @@
"isSlow": false, "isSlow": false,
"since": "v1.44.0" "since": "v1.44.0"
}, },
{
"name": "deadcode",
"desc": "Deprecated",
"loadMode": 575,
"inPresets": [
"unused"
],
"originalURL": "https://github.com/remyoudompheng/go-misc/tree/master/deadcode",
"internal": false,
"isSlow": true,
"since": "v1.0.0",
"deprecation": {
"since": "v1.49.0",
"message": "The owner seems to have abandoned the linter.",
"replacement": "unused"
}
},
{ {
"name": "depguard", "name": "depguard",
"desc": "Go linter that checks if package imports are in a list of acceptable packages", "desc": "Go linter that checks if package imports are in a list of acceptable packages",
@ -247,10 +242,14 @@
"inPresets": [ "inPresets": [
"sql" "sql"
], ],
"originalURL": "https://github.com/lufeee/execinquery", "originalURL": "https://github.com/1uf3/execinquery",
"internal": false, "internal": false,
"isSlow": true, "isSlow": true,
"since": "v1.46.0" "since": "v1.46.0",
"deprecation": {
"since": "v1.58.0",
"message": "The repository of the linter has been archived by the owner."
}
}, },
{ {
"name": "exhaustive", "name": "exhaustive",
@ -264,24 +263,6 @@
"isSlow": true, "isSlow": true,
"since": " v1.28.0" "since": " v1.28.0"
}, },
{
"name": "exhaustivestruct",
"desc": "Deprecated",
"loadMode": 575,
"inPresets": [
"style",
"test"
],
"originalURL": "https://github.com/mbilski/exhaustivestruct",
"internal": false,
"isSlow": true,
"since": "v1.32.0",
"deprecation": {
"since": "v1.46.0",
"message": "The repository of the linter has been deprecated by the owner.",
"replacement": "exhaustruct"
}
},
{ {
"name": "exhaustruct", "name": "exhaustruct",
"desc": "Checks if all structure fields are initialized", "desc": "Checks if all structure fields are initialized",
@ -331,6 +312,18 @@
"isSlow": false, "isSlow": false,
"since": "v1.38.0" "since": "v1.38.0"
}, },
{
"name": "fatcontext",
"desc": "detects nested contexts in loops",
"loadMode": 575,
"inPresets": [
"performance"
],
"originalURL": "https://github.com/Crocmagnon/fatcontext",
"internal": false,
"isSlow": true,
"since": "1.58.0"
},
{ {
"name": "funlen", "name": "funlen",
"desc": "Tool for detection of long functions", "desc": "Tool for detection of long functions",
@ -494,13 +487,16 @@
"since": "v1.19.0" "since": "v1.19.0"
}, },
{ {
"name": "goerr113", "name": "err113",
"desc": "Go linter to check the errors handling expressions", "desc": "Go linter to check the errors handling expressions",
"loadMode": 575, "loadMode": 575,
"inPresets": [ "inPresets": [
"style", "style",
"error" "error"
], ],
"alternativeNames": [
"goerr113"
],
"originalURL": "https://github.com/Djarvur/go-err113", "originalURL": "https://github.com/Djarvur/go-err113",
"internal": false, "internal": false,
"isSlow": true, "isSlow": true,
@ -560,21 +556,16 @@
"since": "v1.20.0" "since": "v1.20.0"
}, },
{ {
"name": "golint", "name": "mnd",
"desc": "Deprecated", "desc": "An analyzer to detect magic numbers.",
"loadMode": 575, "loadMode": 7,
"inPresets": [ "inPresets": [
"style" "style"
], ],
"originalURL": "https://github.com/golang/lint", "originalURL": "https://github.com/tommy-muehle/go-mnd",
"internal": false, "internal": false,
"isSlow": true, "isSlow": false,
"since": "v1.0.0", "since": "v1.22.0"
"deprecation": {
"since": "v1.41.0",
"message": "The repository of the linter has been archived by the owner.",
"replacement": "revive"
}
}, },
{ {
"name": "gomnd", "name": "gomnd",
@ -586,7 +577,12 @@
"originalURL": "https://github.com/tommy-muehle/go-mnd", "originalURL": "https://github.com/tommy-muehle/go-mnd",
"internal": false, "internal": false,
"isSlow": false, "isSlow": false,
"since": "v1.22.0" "since": "v1.22.0",
"deprecation": {
"since": "v1.58.0",
"message": "The linter has been renamed.",
"replacement": "mnd"
}
}, },
{ {
"name": "gomoddirectives", "name": "gomoddirectives",
@ -700,22 +696,6 @@
"isSlow": false, "isSlow": false,
"since": "v1.44.0" "since": "v1.44.0"
}, },
{
"name": "ifshort",
"desc": "Deprecated",
"loadMode": 7,
"inPresets": [
"style"
],
"originalURL": "https://github.com/esimonov/ifshort",
"internal": false,
"isSlow": false,
"since": "v1.36.0",
"deprecation": {
"since": "v1.48.0",
"message": "The repository of the linter has been deprecated by the owner."
}
},
{ {
"name": "importas", "name": "importas",
"desc": "Enforces consistent import aliases", "desc": "Enforces consistent import aliases",
@ -765,22 +745,6 @@
"isSlow": false, "isSlow": false,
"since": "v1.49.0" "since": "v1.49.0"
}, },
{
"name": "interfacer",
"desc": "Deprecated",
"loadMode": 575,
"inPresets": [
"style"
],
"originalURL": "https://github.com/mvdan/interfacer",
"internal": false,
"isSlow": true,
"since": "v1.0.0",
"deprecation": {
"since": "v1.38.0",
"message": "The repository of the linter has been archived by the owner."
}
},
{ {
"name": "intrange", "name": "intrange",
"desc": "intrange is a linter to find places where for loops could make use of an integer range.", "desc": "intrange is a linter to find places where for loops could make use of an integer range.",
@ -854,23 +818,6 @@
"isSlow": true, "isSlow": true,
"since": "v1.34.0" "since": "v1.34.0"
}, },
{
"name": "maligned",
"desc": "Deprecated",
"loadMode": 575,
"inPresets": [
"performance"
],
"originalURL": "https://github.com/mdempsky/maligned",
"internal": false,
"isSlow": true,
"since": "v1.0.0",
"deprecation": {
"since": "v1.38.0",
"message": "The repository of the linter has been archived by the owner.",
"replacement": "govet 'fieldalignment'"
}
},
{ {
"name": "mirror", "name": "mirror",
"desc": "reports wrong mirror patterns of bytes/strings usage", "desc": "reports wrong mirror patterns of bytes/strings usage",
@ -996,23 +943,6 @@
"isSlow": true, "isSlow": true,
"since": "v1.46.0" "since": "v1.46.0"
}, },
{
"name": "nosnakecase",
"desc": "Deprecated",
"loadMode": 7,
"inPresets": [
"style"
],
"originalURL": "https://github.com/sivchari/nosnakecase",
"internal": false,
"isSlow": false,
"since": "v1.47.0",
"deprecation": {
"since": "v1.48.1",
"message": "The repository of the linter has been deprecated by the owner.",
"replacement": "revive 'var-naming'"
}
},
{ {
"name": "nosprintfhostport", "name": "nosprintfhostport",
"desc": "Checks for misuse of Sprintf to construct a host with port in a URL.", "desc": "Checks for misuse of Sprintf to construct a host with port in a URL.",
@ -1150,23 +1080,6 @@
"isSlow": true, "isSlow": true,
"since": "v1.55.0" "since": "v1.55.0"
}, },
{
"name": "scopelint",
"desc": "Deprecated",
"loadMode": 7,
"inPresets": [
"bugs"
],
"originalURL": "https://github.com/kyoh86/scopelint",
"internal": false,
"isSlow": false,
"since": "v1.12.0",
"deprecation": {
"since": "v1.39.0",
"message": "The repository of the linter has been deprecated by the owner.",
"replacement": "exportloopref"
}
},
{ {
"name": "sqlclosecheck", "name": "sqlclosecheck",
"desc": "Checks that sql.Rows, sql.Stmt, sqlx.NamedStmt, pgx.Query are closed.", "desc": "Checks that sql.Rows, sql.Stmt, sqlx.NamedStmt, pgx.Query are closed.",
@ -1209,23 +1122,6 @@
"isSlow": true, "isSlow": true,
"since": "v1.0.0" "since": "v1.0.0"
}, },
{
"name": "structcheck",
"desc": "Deprecated",
"loadMode": 575,
"inPresets": [
"unused"
],
"originalURL": "https://github.com/opennota/check",
"internal": false,
"isSlow": true,
"since": "v1.0.0",
"deprecation": {
"since": "v1.49.0",
"message": "The owner seems to have abandoned the linter.",
"replacement": "unused"
}
},
{ {
"name": "stylecheck", "name": "stylecheck",
"desc": "Stylecheck is a replacement for golint", "desc": "Stylecheck is a replacement for golint",
@ -1343,12 +1239,9 @@
"name": "typecheck", "name": "typecheck",
"desc": "Like the front-end of a Go compiler, parses and type-checks Go code", "desc": "Like the front-end of a Go compiler, parses and type-checks Go code",
"enabledByDefault": true, "enabledByDefault": true,
"loadMode": 575, "loadMode": 7,
"inPresets": [
"bugs"
],
"internal": true, "internal": true,
"isSlow": true, "isSlow": false,
"since": "v1.3.0" "since": "v1.3.0"
}, },
{ {
@ -1404,23 +1297,6 @@
"isSlow": false, "isSlow": false,
"since": "v1.48.0" "since": "v1.48.0"
}, },
{
"name": "varcheck",
"desc": "Deprecated",
"loadMode": 575,
"inPresets": [
"unused"
],
"originalURL": "https://github.com/opennota/check",
"internal": false,
"isSlow": true,
"since": "v1.0.0",
"deprecation": {
"since": "v1.49.0",
"message": "The owner seems to have abandoned the linter.",
"replacement": "unused"
}
},
{ {
"name": "varnamelen", "name": "varnamelen",
"desc": "checks that the length of a variable's name matches its scope", "desc": "checks that the length of a variable's name matches its scope",

View File

@ -73,6 +73,8 @@ docker run -t --rm -v $(pwd):/app -w /app golangci/golangci-lint:{.LatestVersion
### macOS ### macOS
#### Brew
Note: brew can use a non-expected version of Go to build the binary, Note: brew can use a non-expected version of Go to build the binary,
so we recommend either using our binaries or be sure of the version of Go used to build. so we recommend either using our binaries or be sure of the version of Go used to build.
@ -92,6 +94,8 @@ brew tap golangci/tap
brew install golangci/tap/golangci-lint brew install golangci/tap/golangci-lint
``` ```
#### Macports
It can also be installed through [macports](https://www.macports.org/) It can also be installed through [macports](https://www.macports.org/)
The macports installation mode is community driven, and not officially maintained by golangci team. The macports installation mode is community driven, and not officially maintained by golangci team.
@ -101,12 +105,24 @@ sudo port install golangci-lint
### Windows ### Windows
You can install a binary on Windows using [chocolatey](https://community.chocolatey.org/packages/golangci-lint): #### Chocolatey
You can install a binary on Windows using [chocolatey](https://community.chocolatey.org/packages/golangci-lint).
```sh ```sh
choco install golangci-lint choco install golangci-lint
``` ```
#### Scoop
You can install a binary on Windows using [scoop](https://scoop.sh).
```sh
scoop install main/golangci-lint
```
The scoop package is not officially maintained by golangci team.
### Install from Source ### Install from Source
Note: such `go install`/`go get` installation aren't guaranteed to work. We recommend using binary installation. Note: such `go install`/`go get` installation aren't guaranteed to work. We recommend using binary installation.

View File

@ -215,6 +215,7 @@
"asciicheck", "asciicheck",
"bidichk", "bidichk",
"bodyclose", "bodyclose",
"canonicalheader",
"containedctx", "containedctx",
"contextcheck", "contextcheck",
"copyloopvar", "copyloopvar",
@ -235,6 +236,7 @@
"exhaustivestruct", "exhaustivestruct",
"exhaustruct", "exhaustruct",
"exportloopref", "exportloopref",
"fatcontext",
"forbidigo", "forbidigo",
"forcetypeassert", "forcetypeassert",
"funlen", "funlen",
@ -250,13 +252,12 @@
"gocyclo", "gocyclo",
"godot", "godot",
"godox", "godox",
"goerr113", "err113",
"gofmt", "gofmt",
"gofumpt", "gofumpt",
"goheader", "goheader",
"goimports", "goimports",
"golint", "golint",
"gomnd",
"gomoddirectives", "gomoddirectives",
"gomodguard", "gomodguard",
"goprintffuncname", "goprintffuncname",
@ -280,6 +281,7 @@
"maligned", "maligned",
"mirror", "mirror",
"misspell", "misspell",
"mnd",
"musttag", "musttag",
"nakedret", "nakedret",
"nestif", "nestif",
@ -748,16 +750,6 @@
"type": "boolean", "type": "boolean",
"default": false "default": false
}, },
"ignore": {
"description": "DEPRECATED: use `exclude-functions` instead. Comma-separated list of pairs of the form \"pkg:regex\".",
"type": "string",
"default": "fmt:.*"
},
"exclude": {
"description": "DEPRECATED: use `exclude-functions` instead. Path to a file containing a list of functions to exclude from checking.",
"type": "string",
"examples": ["/path/to/file.txt"]
},
"exclude-functions": { "exclude-functions": {
"description": "List of functions to exclude from checking, where each entry is a single function to exclude", "description": "List of functions to exclude from checking, where each entry is a single function to exclude",
"type": "array", "type": "array",
@ -811,6 +803,36 @@
"description": "Check for plain error comparisons", "description": "Check for plain error comparisons",
"type": "boolean", "type": "boolean",
"default": true "default": true
},
"allowed-errors": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"err": {
"type": "string"
},
"fun": {
"type": "string"
}
}
}
},
"allowed-errors-wildcard": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"err": {
"type": "string"
},
"fun": {
"type": "string"
}
}
}
} }
} }
}, },
@ -960,16 +982,25 @@
"type": "object", "type": "object",
"additionalProperties": false, "additionalProperties": false,
"properties": { "properties": {
"local-prefixes": {
"description": "DEPRECATED: use 'sections' and 'prefix(github.com/org/project)' instead.",
"type": "string",
"examples": ["github.com/org/project"]
},
"sections": { "sections": {
"description": "Section configuration to compare against.", "description": "Section configuration to compare against.",
"type": "array", "type": "array",
"items": { "items": {
"type": "string" "anyOf": [
{
"enum": [
"standard",
"default",
"blank",
"dot",
"alias",
"localmodule"
]
},
{
"type": "string"
}
]
}, },
"default": ["standard", "default"] "default": ["standard", "default"]
}, },
@ -1143,8 +1174,157 @@
"settings": { "settings": {
"description": "Settings passed to gocritic. Properties must be valid and enabled check names.", "description": "Settings passed to gocritic. Properties must be valid and enabled check names.",
"type": "object", "type": "object",
"propertyNames": { "additionalProperties": false,
"$ref": "#/definitions/gocritic-checks" "properties": {
"captLocal": {
"type": "object",
"additionalProperties": false,
"properties": {
"paramsOnly" : {
"type": "boolean",
"default": true
}
}
},
"commentedOutCode": {
"type": "object",
"additionalProperties": false,
"properties": {
"minLength" : {
"type": "number",
"default": 15
}
}
},
"elseif": {
"type": "object",
"additionalProperties": false,
"properties": {
"skipBalanced" : {
"type": "boolean",
"default": true
}
}
},
"hugeParam": {
"type": "object",
"additionalProperties": false,
"properties": {
"sizeThreshold" : {
"type": "number",
"default": 80
}
}
},
"ifElseChain": {
"type": "object",
"additionalProperties": false,
"properties": {
"minThreshold" : {
"type": "number",
"default": 2
}
}
},
"nestingReduce": {
"type": "object",
"additionalProperties": false,
"properties": {
"bodyWidth" : {
"type": "number",
"default": 5
}
}
},
"rangeExprCopy": {
"type": "object",
"additionalProperties": false,
"properties": {
"sizeThreshold" : {
"type": "number",
"default": 512
},
"skipTestFuncs" : {
"type": "boolean",
"default": true
}
}
},
"rangeValCopy": {
"type": "object",
"additionalProperties": false,
"properties": {
"sizeThreshold" : {
"type": "number",
"default": 128
},
"skipTestFuncs" : {
"type": "boolean",
"default": true
}
}
},
"ruleguard": {
"type": "object",
"additionalProperties": false,
"properties": {
"debug" : {
"type": "string"
},
"enable" : {
"type": "string"
},
"disable" : {
"type": "string"
},
"failOn" : {
"type": "string"
},
"rules" : {
"type": "string"
}
}
},
"tooManyResultsChecker": {
"type": "object",
"additionalProperties": false,
"properties": {
"maxResults" : {
"type": "number",
"default": 5
}
}
},
"truncateCmp": {
"type": "object",
"additionalProperties": false,
"properties": {
"skipArchDependent" : {
"type": "boolean",
"default": true
}
}
},
"underef": {
"type": "object",
"additionalProperties": false,
"properties": {
"skipRecvDeref" : {
"type": "boolean",
"default": true
}
}
},
"unnamedResult": {
"type": "object",
"additionalProperties": false,
"properties": {
"checkExported" : {
"type": "boolean",
"default": false
}
}
}
} }
}, },
"disable-all": { "disable-all": {
@ -1261,11 +1441,6 @@
"type": "boolean", "type": "boolean",
"default": false "default": false
}, },
"lang-version": {
"description": "Select the Go version to target.",
"type": "string",
"default": "1.15"
},
"module-path": { "module-path": {
"description": " Module path which contains the source code being formatted.", "description": " Module path which contains the source code being formatted.",
"type": "string" "type": "string"
@ -1343,50 +1518,6 @@
} }
} }
}, },
"gomnd": {
"type": "object",
"additionalProperties": false,
"properties": {
"ignored-files": {
"description": "List of file patterns to exclude from analysis.",
"examples": [["magic1_.*.go"]],
"type": "array",
"items": {
"type": "string"
}
},
"ignored-functions": {
"description": "Comma-separated list of function patterns to exclude from the analysis.",
"examples": [["math.*", "http.StatusText", "make"]],
"type": "array",
"items": {
"type": "string"
}
},
"ignored-numbers": {
"description": "List of numbers to exclude from analysis.",
"examples": [["1000", "1234_567_890", "3.14159264"]],
"type": "array",
"items": {
"type": "string"
}
},
"checks": {
"description": "The list of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description.",
"type": "array",
"items": {
"enum": [
"argument",
"case",
"condition",
"operation",
"return",
"assign"
]
}
}
}
},
"gomoddirectives": { "gomoddirectives": {
"type": "object", "type": "object",
"additionalProperties": false, "additionalProperties": false,
@ -1509,11 +1640,6 @@
"type": "object", "type": "object",
"additionalProperties": false, "additionalProperties": false,
"properties": { "properties": {
"go": {
"description": "Targeted Go version",
"type": "string",
"default": "1.13"
},
"checks": { "checks": {
"type": "array", "type": "array",
"items": { "items": {
@ -1976,6 +2102,50 @@
} }
} }
}, },
"mnd": {
"type": "object",
"additionalProperties": false,
"properties": {
"ignored-files": {
"description": "List of file patterns to exclude from analysis.",
"examples": [["magic1_.*.go"]],
"type": "array",
"items": {
"type": "string"
}
},
"ignored-functions": {
"description": "Comma-separated list of function patterns to exclude from the analysis.",
"examples": [["math.*", "http.StatusText", "make"]],
"type": "array",
"items": {
"type": "string"
}
},
"ignored-numbers": {
"description": "List of numbers to exclude from analysis.",
"examples": [["1000", "1234_567_890", "3.14159264"]],
"type": "array",
"items": {
"type": "string"
}
},
"checks": {
"description": "The list of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description.",
"type": "array",
"items": {
"enum": [
"argument",
"case",
"condition",
"operation",
"return",
"assign"
]
}
}
}
},
"nolintlint": { "nolintlint": {
"type": "object", "type": "object",
"additionalProperties": false, "additionalProperties": false,
@ -2274,10 +2444,10 @@
"type": "boolean", "type": "boolean",
"default": true "default": true
}, },
"context-only": { "context": {
"description": "Enforce using methods that accept a context.", "description": "Enforce using methods that accept a context.",
"type": "boolean", "enum": ["", "all", "scope"],
"default": false "default": ""
}, },
"static-msg": { "static-msg": {
"description": "Enforce using static values for log messages.", "description": "Enforce using static values for log messages.",
@ -2322,6 +2492,13 @@
"items": { "items": {
"type": "string" "type": "string"
} }
},
"extra-start-span-signatures": {
"description": "A list of regexes for additional function signatures that create spans.",
"type": "array",
"items": {
"type": "string"
}
} }
} }
}, },
@ -2329,11 +2506,6 @@
"type": "object", "type": "object",
"additionalProperties": false, "additionalProperties": false,
"properties": { "properties": {
"go": {
"description": "Targeted Go version",
"type": "string",
"default": "1.13"
},
"checks": { "checks": {
"type": "array", "type": "array",
"items": { "items": {
@ -2353,11 +2525,6 @@
"type": "object", "type": "object",
"additionalProperties": false, "additionalProperties": false,
"properties": { "properties": {
"go": {
"description": "Targeted Go version",
"type": "string",
"default": "1.13"
},
"checks": { "checks": {
"type": "array", "type": "array",
"items": { "items": {
@ -2855,11 +3022,6 @@
"type": "boolean", "type": "boolean",
"default": false "default": false
}, },
"os-dev-null": {
"description": "Suggest the use of os.DevNull.",
"type": "boolean",
"default": false
},
"sql-isolation-level": { "sql-isolation-level": {
"description": "Suggest the use of sql.LevelXX.String().", "description": "Suggest the use of sql.LevelXX.String().",
"type": "boolean", "type": "boolean",
@ -2874,11 +3036,6 @@
"description": "Suggest the use of constant.Kind.String().", "description": "Suggest the use of constant.Kind.String().",
"type": "boolean", "type": "boolean",
"default": false "default": false
},
"syslog-priority": {
"description": "Suggest the use of syslog.Priority.",
"type": "boolean",
"default": false
} }
} }
}, },
@ -3157,7 +3314,7 @@
"type": "object", "type": "object",
"additionalProperties": false, "additionalProperties": false,
"properties": { "properties": {
"ignore-alias": { "check-alias": {
"type": "boolean", "type": "boolean",
"default": false "default": false
} }

View File

@ -15,6 +15,8 @@ import (
"github.com/golangci/golangci-lint/pkg/result/processors" "github.com/golangci/golangci-lint/pkg/result/processors"
) )
const defaultMaxIssuesPerLinter = 50
func setupLintersFlagSet(v *viper.Viper, fs *pflag.FlagSet) { func setupLintersFlagSet(v *viper.Viper, fs *pflag.FlagSet) {
internal.AddHackedStringSliceP(fs, "disable", "D", color.GreenString("Disable specific linter")) internal.AddHackedStringSliceP(fs, "disable", "D", color.GreenString("Disable specific linter"))
internal.AddFlagAndBind(v, fs, fs.Bool, "disable-all", "linters.disable-all", false, color.GreenString("Disable all linters")) internal.AddFlagAndBind(v, fs, fs.Bool, "disable-all", "linters.disable-all", false, color.GreenString("Disable all linters"))
@ -91,7 +93,7 @@ func setupIssuesFlagSet(v *viper.Viper, fs *pflag.FlagSet) {
internal.AddFlagAndBind(v, fs, fs.Bool, "exclude-case-sensitive", "issues.exclude-case-sensitive", false, internal.AddFlagAndBind(v, fs, fs.Bool, "exclude-case-sensitive", "issues.exclude-case-sensitive", false,
color.GreenString("If set to true exclude and exclude rules regular expressions are case-sensitive")) color.GreenString("If set to true exclude and exclude rules regular expressions are case-sensitive"))
internal.AddFlagAndBind(v, fs, fs.Int, "max-issues-per-linter", "issues.max-issues-per-linter", 50, internal.AddFlagAndBind(v, fs, fs.Int, "max-issues-per-linter", "issues.max-issues-per-linter", defaultMaxIssuesPerLinter,
color.GreenString("Maximum issues count per one linter. Set to 0 to disable")) color.GreenString("Maximum issues count per one linter. Set to 0 to disable"))
internal.AddFlagAndBind(v, fs, fs.Int, "max-same-issues", "issues.max-same-issues", 3, internal.AddFlagAndBind(v, fs, fs.Int, "max-same-issues", "issues.max-same-issues", 3,
color.GreenString("Maximum count of issues with the same text. Set to 0 to disable")) color.GreenString("Maximum count of issues with the same text. Set to 0 to disable"))