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
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
uses: peter-evans/create-pull-request@v6
with:

View File

@ -154,9 +154,9 @@ linters-settings:
pop-directional-isolate: false
copyloopvar:
# If true, ignore aliasing of loop variables.
# Check all assigning the loop variable to another variable.
# Default: false
ignore-alias: true
check-alias: true
cyclop:
# The maximal code complexity to report.
@ -279,23 +279,11 @@ linters-settings:
# Default: false
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.
# See `-excludeonly` option in https://github.com/kisielk/errcheck#excluding-functions for details.
# Default: false
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.
# See https://github.com/kisielk/errcheck#excluding-functions for details.
exclude-functions:
@ -338,6 +326,16 @@ linters-settings:
# Check for plain error comparisons.
# Default: true
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:
# Program elements to check for exhaustiveness.
@ -431,12 +429,9 @@ linters-settings:
ignore-comments: true
gci:
# DEPRECATED: use `sections` and `prefix(github.com/org/project)` instead.
local-prefixes: github.com/org/project
# Section configuration to compare against.
# 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.
# Default: ["standard", "default"]
sections:
@ -446,6 +441,7 @@ linters-settings:
- 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.
- 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.
# Default: true
@ -636,9 +632,6 @@ linters-settings:
# The option is passed to the ruleguard 'debug-group' argument.
# Default: ""
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.
# 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.
@ -646,7 +639,7 @@ linters-settings:
# - 'import': ruleguard rule imports a package that cannot be found.
# - 'dsl': gorule file does not comply with the ruleguard DSL.
# Default: ""
failOn: dsl
failOn: dsl,import
# 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.
# The special '${configDir}' variable is substituted with the absolute directory containing the golangci config file.
@ -723,9 +716,6 @@ linters-settings:
replacement: 'a[b:]'
gofumpt:
# Deprecated: use the global `run.go` instead.
lang-version: "1.17"
# Module path which contains the source code being formatted.
# Default: ""
module-path: github.com/org/project
@ -779,38 +769,6 @@ linters-settings:
# Default: ""
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:
# Allow local `replace` directives.
# Default: false
@ -861,8 +819,6 @@ linters-settings:
local_replace_directives: false
gosimple:
# Deprecated: use the global `run.go` instead.
go: "1.15"
# Sxxxx checks in https://staticcheck.io/docs/configuration/options/#checks
# Default: ["*"]
checks: [ "all" ]
@ -1367,6 +1323,38 @@ linters-settings:
# Default: ""
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:
# 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
@ -2013,8 +2001,12 @@ linters-settings:
# Default: ""
no-global: "all"
# Enforce using methods that accept a context.
# Default: false
context-only: true
# Values:
# - "": 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.
# Default: false
static-msg: true
@ -2046,17 +2038,19 @@ linters-settings:
# Default: []
ignore-check-signatures:
- "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:
# Deprecated: use the global `run.go` instead.
go: "1.15"
# SAxxxx checks in https://staticcheck.io/docs/configuration/options/#checks
# Default: ["*"]
checks: [ "all" ]
stylecheck:
# Deprecated: use the global `run.go` instead.
go: "1.15"
# STxxxx checks in https://staticcheck.io/docs/configuration/options/#checks
# Default: ["*"]
checks: [ "all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022" ]
@ -2280,9 +2274,6 @@ linters-settings:
# Suggest the use of rpc.DefaultXXPath.
# Default: false
default-rpc-path: true
# DEPRECATED Suggest the use of os.DevNull.
# Default: false
os-dev-null: true
# Suggest the use of sql.LevelXX.String().
# Default: false
sql-isolation-level: true
@ -2292,9 +2283,6 @@ linters-settings:
# Suggest the use of constant.Kind.String().
# Default: false
constant-kind: true
# DEPRECATED Suggest the use of syslog.Priority.
# Default: false
syslog-priority: true
unconvert:
# Remove conversions that force intermediate rounding.
@ -2514,6 +2502,7 @@ linters:
- asciicheck
- bidichk
- bodyclose
- canonicalheader
- containedctx
- contextcheck
- copyloopvar
@ -2524,6 +2513,7 @@ linters:
- dupl
- dupword
- durationcheck
- err113
- errcheck
- errchkjson
- errname
@ -2532,6 +2522,7 @@ linters:
- exhaustive
- exhaustruct
- exportloopref
- fatcontext
- forbidigo
- forcetypeassert
- funlen
@ -2547,12 +2538,10 @@ linters:
- gocyclo
- godot
- godox
- goerr113
- gofmt
- gofumpt
- goheader
- goimports
- gomnd
- gomoddirectives
- gomodguard
- goprintffuncname
@ -2573,6 +2562,7 @@ linters:
- makezero
- mirror
- misspell
- mnd
- musttag
- nakedret
- nestif
@ -2627,6 +2617,7 @@ linters:
- asciicheck
- bidichk
- bodyclose
- canonicalheader
- containedctx
- contextcheck
- copyloopvar
@ -2637,6 +2628,7 @@ linters:
- dupl
- dupword
- durationcheck
- err113
- errcheck
- errchkjson
- errname
@ -2645,6 +2637,7 @@ linters:
- exhaustive
- exhaustruct
- exportloopref
- fatcontext
- forbidigo
- forcetypeassert
- funlen
@ -2660,12 +2653,10 @@ linters:
- gocyclo
- godot
- godox
- goerr113
- gofmt
- gofumpt
- goheader
- goimports
- gomnd
- gomoddirectives
- gomodguard
- goprintffuncname
@ -2686,6 +2677,7 @@ linters:
- makezero
- mirror
- misspell
- mnd
- musttag
- nakedret
- nestif
@ -2735,6 +2727,7 @@ linters:
- ifshort # Deprecated
- interfacer # Deprecated
- maligned # Deprecated
- gomnd # Deprecated
- nosnakecase # Deprecated
- scopelint # Deprecated
- structcheck # Deprecated

View File

@ -57,7 +57,7 @@ linters-settings:
replacement: 'any'
goimports:
local-prefixes: github.com/golangci/golangci-lint
gomnd:
mnd:
# don't include the "operation" and "assign"
checks:
- argument
@ -121,7 +121,7 @@ linters:
- godox
- gofmt
- goimports
- gomnd
- mnd
- goprintffuncname
- gosec
- gosimple
@ -150,7 +150,7 @@ issues:
- path: (.+)_test\.go
linters:
- dupl
- gomnd
- mnd
- lll
# 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:
### 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
1. Updated linters
@ -12,16 +71,16 @@ There is the most valuable changes log:
* `gomoddirectives`: from 0.2.3 to 0.2.4
* `intrange`: from 0.1.0 to 0.1.1
2. Misc.
* fix: display warnings on deprecated linter options
* fix: missing `colored-tab` output format
* fix: TeamCity `inspectionType` service message
* Display warnings on deprecated linter options
* Fix missing `colored-tab` output format
* Fix TeamCity `inspectionType` service message
3. Documentation
* Remove invalid example about mixing files and directory
* Improve linters page
### v1.57.1
1. Fixes:
1. Fixes
* Ignore issues with invalid position (e.g. `contextcheck`).
### 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 custom sort order for the reports (`output.sort-order`)
* 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`)
* Syntax to not override `severity` from linters (`@linter`)
* Use severities from `gosec`

File diff suppressed because one or more lines are too long

View File

@ -3,90 +3,90 @@
"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",
"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",
"pattern": "(comment on exported (method|function|type|const)|should have( a package)? comment|comment should be of the form)",
"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",
"pattern": "func name will be used as test\\.Test.* by other packages, and that stutters; consider calling this",
"linter": "golint",
"why": "False positive when tests are defined in package 'test'"
"why": "False positive when tests are defined in package 'test'."
},
{
"id": "EXC0004",
"pattern": "(possible misuse of unsafe.Pointer|should have signature)",
"linter": "govet",
"why": "Common false positives"
"why": "Common false positives."
},
{
"id": "EXC0005",
"pattern": "ineffective break statement. Did you mean to break out of the outer loop",
"pattern": "SA4011",
"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",
"pattern": "Use of unsafe calls should be audited",
"pattern": "G103: Use of unsafe calls should be audited",
"linter": "gosec",
"why": "Too many false-positives on 'unsafe' usage"
"why": "Too many false-positives on 'unsafe' usage."
},
{
"id": "EXC0007",
"pattern": "Subprocess launch(ed with variable|ing should be audited)",
"pattern": "G204: Subprocess launched with variable",
"linter": "gosec",
"why": "Too many false-positives for parametrized shell calls"
"why": "Too many false-positives for parametrized shell calls."
},
{
"id": "EXC0008",
"pattern": "(G104)",
"pattern": "G104",
"linter": "gosec",
"why": "Duplicated errcheck checks"
"why": "Duplicated errcheck checks."
},
{
"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",
"why": "Too many issues in popular repos"
"why": "Too many issues in popular repos."
},
{
"id": "EXC0010",
"pattern": "Potential file inclusion via variable",
"pattern": "G304: Potential file inclusion via variable",
"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",
"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",
"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",
"pattern": "exported (.+) should have comment( \\(or a comment on this block\\))? or be unexported",
"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",
"pattern": "package comment should be of the form \"(.+)...",
"pattern": "package comment should be of the form \"(.+)...\"",
"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",
"pattern": "comment on exported (.+) should be of the form \"(.+)...\"",
"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",
"pattern": "should have a package comment",
"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,
"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",
"desc": "containedctx is a linter that detects struct contained context.Context field",
@ -110,23 +122,6 @@
"isSlow": false,
"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",
"desc": "Go linter that checks if package imports are in a list of acceptable packages",
@ -247,10 +242,14 @@
"inPresets": [
"sql"
],
"originalURL": "https://github.com/lufeee/execinquery",
"originalURL": "https://github.com/1uf3/execinquery",
"internal": false,
"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",
@ -264,24 +263,6 @@
"isSlow": true,
"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",
"desc": "Checks if all structure fields are initialized",
@ -331,6 +312,18 @@
"isSlow": false,
"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",
"desc": "Tool for detection of long functions",
@ -494,13 +487,16 @@
"since": "v1.19.0"
},
{
"name": "goerr113",
"name": "err113",
"desc": "Go linter to check the errors handling expressions",
"loadMode": 575,
"inPresets": [
"style",
"error"
],
"alternativeNames": [
"goerr113"
],
"originalURL": "https://github.com/Djarvur/go-err113",
"internal": false,
"isSlow": true,
@ -560,21 +556,16 @@
"since": "v1.20.0"
},
{
"name": "golint",
"desc": "Deprecated",
"loadMode": 575,
"name": "mnd",
"desc": "An analyzer to detect magic numbers.",
"loadMode": 7,
"inPresets": [
"style"
],
"originalURL": "https://github.com/golang/lint",
"originalURL": "https://github.com/tommy-muehle/go-mnd",
"internal": false,
"isSlow": true,
"since": "v1.0.0",
"deprecation": {
"since": "v1.41.0",
"message": "The repository of the linter has been archived by the owner.",
"replacement": "revive"
}
"isSlow": false,
"since": "v1.22.0"
},
{
"name": "gomnd",
@ -586,7 +577,12 @@
"originalURL": "https://github.com/tommy-muehle/go-mnd",
"internal": 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",
@ -700,22 +696,6 @@
"isSlow": false,
"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",
"desc": "Enforces consistent import aliases",
@ -765,22 +745,6 @@
"isSlow": false,
"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",
"desc": "intrange is a linter to find places where for loops could make use of an integer range.",
@ -854,23 +818,6 @@
"isSlow": true,
"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",
"desc": "reports wrong mirror patterns of bytes/strings usage",
@ -996,23 +943,6 @@
"isSlow": true,
"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",
"desc": "Checks for misuse of Sprintf to construct a host with port in a URL.",
@ -1150,23 +1080,6 @@
"isSlow": true,
"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",
"desc": "Checks that sql.Rows, sql.Stmt, sqlx.NamedStmt, pgx.Query are closed.",
@ -1209,23 +1122,6 @@
"isSlow": true,
"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",
"desc": "Stylecheck is a replacement for golint",
@ -1343,12 +1239,9 @@
"name": "typecheck",
"desc": "Like the front-end of a Go compiler, parses and type-checks Go code",
"enabledByDefault": true,
"loadMode": 575,
"inPresets": [
"bugs"
],
"loadMode": 7,
"internal": true,
"isSlow": true,
"isSlow": false,
"since": "v1.3.0"
},
{
@ -1404,23 +1297,6 @@
"isSlow": false,
"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",
"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
#### Brew
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.
@ -92,6 +94,8 @@ brew tap golangci/tap
brew install golangci/tap/golangci-lint
```
#### Macports
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.
@ -101,12 +105,24 @@ sudo port install golangci-lint
### 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
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
Note: such `go install`/`go get` installation aren't guaranteed to work. We recommend using binary installation.

View File

@ -215,6 +215,7 @@
"asciicheck",
"bidichk",
"bodyclose",
"canonicalheader",
"containedctx",
"contextcheck",
"copyloopvar",
@ -235,6 +236,7 @@
"exhaustivestruct",
"exhaustruct",
"exportloopref",
"fatcontext",
"forbidigo",
"forcetypeassert",
"funlen",
@ -250,13 +252,12 @@
"gocyclo",
"godot",
"godox",
"goerr113",
"err113",
"gofmt",
"gofumpt",
"goheader",
"goimports",
"golint",
"gomnd",
"gomoddirectives",
"gomodguard",
"goprintffuncname",
@ -280,6 +281,7 @@
"maligned",
"mirror",
"misspell",
"mnd",
"musttag",
"nakedret",
"nestif",
@ -748,16 +750,6 @@
"type": "boolean",
"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": {
"description": "List of functions to exclude from checking, where each entry is a single function to exclude",
"type": "array",
@ -811,6 +803,36 @@
"description": "Check for plain error comparisons",
"type": "boolean",
"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",
"additionalProperties": false,
"properties": {
"local-prefixes": {
"description": "DEPRECATED: use 'sections' and 'prefix(github.com/org/project)' instead.",
"type": "string",
"examples": ["github.com/org/project"]
},
"sections": {
"description": "Section configuration to compare against.",
"type": "array",
"items": {
"type": "string"
"anyOf": [
{
"enum": [
"standard",
"default",
"blank",
"dot",
"alias",
"localmodule"
]
},
{
"type": "string"
}
]
},
"default": ["standard", "default"]
},
@ -1143,8 +1174,157 @@
"settings": {
"description": "Settings passed to gocritic. Properties must be valid and enabled check names.",
"type": "object",
"propertyNames": {
"$ref": "#/definitions/gocritic-checks"
"additionalProperties": false,
"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": {
@ -1261,11 +1441,6 @@
"type": "boolean",
"default": false
},
"lang-version": {
"description": "Select the Go version to target.",
"type": "string",
"default": "1.15"
},
"module-path": {
"description": " Module path which contains the source code being formatted.",
"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": {
"type": "object",
"additionalProperties": false,
@ -1509,11 +1640,6 @@
"type": "object",
"additionalProperties": false,
"properties": {
"go": {
"description": "Targeted Go version",
"type": "string",
"default": "1.13"
},
"checks": {
"type": "array",
"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": {
"type": "object",
"additionalProperties": false,
@ -2274,10 +2444,10 @@
"type": "boolean",
"default": true
},
"context-only": {
"context": {
"description": "Enforce using methods that accept a context.",
"type": "boolean",
"default": false
"enum": ["", "all", "scope"],
"default": ""
},
"static-msg": {
"description": "Enforce using static values for log messages.",
@ -2322,6 +2492,13 @@
"items": {
"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",
"additionalProperties": false,
"properties": {
"go": {
"description": "Targeted Go version",
"type": "string",
"default": "1.13"
},
"checks": {
"type": "array",
"items": {
@ -2353,11 +2525,6 @@
"type": "object",
"additionalProperties": false,
"properties": {
"go": {
"description": "Targeted Go version",
"type": "string",
"default": "1.13"
},
"checks": {
"type": "array",
"items": {
@ -2855,11 +3022,6 @@
"type": "boolean",
"default": false
},
"os-dev-null": {
"description": "Suggest the use of os.DevNull.",
"type": "boolean",
"default": false
},
"sql-isolation-level": {
"description": "Suggest the use of sql.LevelXX.String().",
"type": "boolean",
@ -2874,11 +3036,6 @@
"description": "Suggest the use of constant.Kind.String().",
"type": "boolean",
"default": false
},
"syslog-priority": {
"description": "Suggest the use of syslog.Priority.",
"type": "boolean",
"default": false
}
}
},
@ -3157,7 +3314,7 @@
"type": "object",
"additionalProperties": false,
"properties": {
"ignore-alias": {
"check-alias": {
"type": "boolean",
"default": false
}

View File

@ -15,6 +15,8 @@ import (
"github.com/golangci/golangci-lint/pkg/result/processors"
)
const defaultMaxIssuesPerLinter = 50
func setupLintersFlagSet(v *viper.Viper, fs *pflag.FlagSet) {
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"))
@ -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,
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"))
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"))