doc: improve documentation about debugging. (#3434)
This commit is contained in:
parent
ab8a120755
commit
cca68dcffe
@ -4,12 +4,21 @@ title: Debugging
|
|||||||
|
|
||||||
You can see a verbose output of linter by using `-v` option.
|
You can see a verbose output of linter by using `-v` option.
|
||||||
|
|
||||||
If you would like to see more detailed logs you can set environment variable `GL_DEBUG` to debug `golangci-lint`.
|
```bash
|
||||||
It's value is a list of debug tags. For example, `GL_DEBUG=loader,gocritic golangci-lint run`.
|
golangci-lint run -v
|
||||||
Existing debug tags:
|
```
|
||||||
|
|
||||||
1. `gocritic` - debug `go-critic` linter;
|
If you would like to see more detailed logs you can use the environment variable `GL_DEBUG`.
|
||||||
2. `env` - debug `go env` command;
|
Its value is a list of debug tags.
|
||||||
3. `loader` - debug packages loading (including `go/packages` internal debugging);
|
|
||||||
4. `autogen_exclude` - debug a filter excluding autogenerated source code;
|
The existing debug tags are documented in the following file: https://github.com/golangci/golangci-lint/blob/master/pkg/logutils/logutils.go
|
||||||
5. `nolint` - debug a filter excluding issues by `//nolint` comments.
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
GL_DEBUG="loader,gocritic" golangci-lint run
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
GL_DEBUG="loader,env" golangci-lint run
|
||||||
|
```
|
||||||
|
@ -13,12 +13,12 @@ import (
|
|||||||
const envDebug = "GL_DEBUG"
|
const envDebug = "GL_DEBUG"
|
||||||
|
|
||||||
const (
|
const (
|
||||||
DebugKeyAutogenExclude = "autogen_exclude"
|
DebugKeyAutogenExclude = "autogen_exclude" // Debugs a filter excluding autogenerated source code.
|
||||||
DebugKeyBinSalt = "bin_salt"
|
DebugKeyBinSalt = "bin_salt"
|
||||||
DebugKeyConfigReader = "config_reader"
|
DebugKeyConfigReader = "config_reader"
|
||||||
DebugKeyEmpty = ""
|
DebugKeyEmpty = ""
|
||||||
DebugKeyEnabledLinters = "enabled_linters"
|
DebugKeyEnabledLinters = "enabled_linters"
|
||||||
DebugKeyEnv = "env"
|
DebugKeyEnv = "env" // Debugs `go env` command.
|
||||||
DebugKeyExcludeRules = "exclude_rules"
|
DebugKeyExcludeRules = "exclude_rules"
|
||||||
DebugKeyExec = "exec"
|
DebugKeyExec = "exec"
|
||||||
DebugKeyFilenameUnadjuster = "filename_unadjuster"
|
DebugKeyFilenameUnadjuster = "filename_unadjuster"
|
||||||
@ -27,7 +27,7 @@ const (
|
|||||||
DebugKeyLintersContext = "linters_context"
|
DebugKeyLintersContext = "linters_context"
|
||||||
DebugKeyLintersDB = "lintersdb"
|
DebugKeyLintersDB = "lintersdb"
|
||||||
DebugKeyLintersOutput = "linters_output"
|
DebugKeyLintersOutput = "linters_output"
|
||||||
DebugKeyLoader = "loader"
|
DebugKeyLoader = "loader" // Debugs packages loading (including `go/packages` internal debugging).
|
||||||
DebugKeyMaxFromLinter = "max_from_linter"
|
DebugKeyMaxFromLinter = "max_from_linter"
|
||||||
DebugKeyMaxSameIssues = "max_same_issues"
|
DebugKeyMaxSameIssues = "max_same_issues"
|
||||||
DebugKeyPkgCache = "pkgcache"
|
DebugKeyPkgCache = "pkgcache"
|
||||||
@ -55,10 +55,10 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
DebugKeyGoCritic = "gocritic"
|
DebugKeyGoCritic = "gocritic" // Debugs `go-critic` linter.
|
||||||
DebugKeyMegacheck = "megacheck"
|
DebugKeyMegacheck = "megacheck" // Debugs `staticcheck` related linters.
|
||||||
DebugKeyNolint = "nolint"
|
DebugKeyNolint = "nolint" // Debugs a filter excluding issues by `//nolint` comments.
|
||||||
DebugKeyRevive = "revive"
|
DebugKeyRevive = "revive" // Debugs `revice` linter.
|
||||||
)
|
)
|
||||||
|
|
||||||
func getEnabledDebugs() map[string]bool {
|
func getEnabledDebugs() map[string]bool {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user