Skip to content

Commit 059cc52

Browse files
authored
docs: improve debug keys documentation (#5930)
1 parent 80027c4 commit 059cc52

File tree

2 files changed

+24
-26
lines changed

2 files changed

+24
-26
lines changed

pkg/commands/fmt.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,13 @@ type fmtCommand struct {
3737

3838
runner *goformat.Runner
3939

40-
log logutils.Log
41-
debugf logutils.DebugFunc
40+
log logutils.Log
4241
}
4342

4443
func newFmtCommand(logger logutils.Log, info BuildInfo) *fmtCommand {
4544
c := &fmtCommand{
4645
viper: viper.New(),
4746
log: logger,
48-
debugf: logutils.Debug(logutils.DebugKeyExec),
4947
cfg: config.NewDefault(),
5048
buildInfo: info,
5149
}

pkg/logutils/logutils.go

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,20 @@ const EnvTestRun = "GL_TEST_RUN"
1616
const envDebug = "GL_DEBUG"
1717

1818
const (
19-
DebugKeyBinSalt = "bin_salt"
20-
DebugKeyGoModSalt = "gomod_salt"
21-
DebugKeyConfigReader = "config_reader"
22-
DebugKeyEmpty = ""
23-
DebugKeyEnabledLinters = "enabled_linters"
24-
DebugKeyExec = "exec"
25-
DebugKeyFormatter = "formatter"
26-
DebugKeyFormattersOutput = "formatters_output"
27-
DebugKeyGoEnv = "goenv"
28-
DebugKeyLintersContext = "linters_context"
29-
DebugKeyLintersDB = "lintersdb"
30-
DebugKeyLintersOutput = "linters_output"
31-
DebugKeyLoader = "loader" // Debugs packages loading (including `go/packages` internal debugging).
32-
DebugKeyPkgCache = "pkgcache"
33-
DebugKeyRunner = "runner"
34-
DebugKeyStopwatch = "stopwatch"
35-
DebugKeyTest = "test"
19+
DebugKeyBinSalt = "bin_salt" // Forces the usage of constant as salt (only for maintainers).
20+
DebugKeyGoModSalt = "gomod_salt" // Display logs related to the salt computation from the go.mod file.
21+
DebugKeyConfigReader = "config_reader" // Display logs related to configuration loading.
22+
DebugKeyEmpty = ""
23+
DebugKeyEnabledLinters = "enabled_linters" // Display logs related to the enabled linters inside the [lintersdb.Manager].
24+
DebugKeyExec = "exec" // Display logs related to the lock file.
25+
DebugKeyGoEnv = "goenv" // Display logs related to [goenv.Env].
26+
DebugKeyLintersContext = "linters_context" // Display logs related to the package analysis context (not related to [context.Context]).
27+
DebugKeyLintersDB = "lintersdb" // Display logs related to the linters/formatters loading.
28+
DebugKeyLoader = "loader" // Display logs related to package loading (including `go/packages` internal debugging).
29+
DebugKeyPkgCache = "pkgcache" // Display logs related to cache.
30+
DebugKeyRunner = "runner" // Display logs related to the linter runner.
31+
DebugKeyStopwatch = "stopwatch" // Display logs related to the stopwatch of the cache.
32+
DebugKeyTest = "test" // Display debug logs during integration tests.
3633
)
3734

3835
// Printers.
@@ -59,7 +56,6 @@ const (
5956
DebugKeyPathPrettifier = "path_prettifier"
6057
DebugKeyPathRelativity = "path_relativity"
6158
DebugKeySeverityRules = "severity_rules"
62-
DebugKeySkipDirs = "skip_dirs"
6359
DebugKeySourceCode = "source_code"
6460
)
6561

@@ -77,12 +73,16 @@ const (
7773
DebugKeyGoAnalysisFactsInherit = DebugKeyGoAnalysisFacts + "/inherit"
7874
)
7975

80-
// Linters.
76+
// Linters and Formatters.
8177
const (
82-
DebugKeyForbidigo = "forbidigo" // Debugs `forbidigo` linter.
83-
DebugKeyGoCritic = "gocritic" // Debugs `gocritic` linter.
84-
DebugKeyGovet = "govet" // Debugs `govet` linter.
85-
DebugKeyLinter = "linter"
78+
DebugKeyFormatter = "formatter" // Display logs from the shared logger for formatters.
79+
DebugKeyFormattersOutput = "formatters_output" // Display logs from formatters themselves.
80+
DebugKeyLinter = "linter" // Display logs from the shared logger for linters.
81+
DebugKeyLintersOutput = "linters_output" // Display logs from linters themselves.
82+
83+
DebugKeyForbidigo = "forbidigo" // Debugs `forbidigo` linter.
84+
DebugKeyGoCritic = "gocritic" // Debugs `gocritic` linter.
85+
DebugKeyGovet = "govet" // Debugs `govet` linter.
8686
DebugKeyRevive = "revive" // Debugs `revive` linter.
8787
DebugKeyStaticcheck = "staticcheck" // Debugs `staticcheck` linter.
8888
)

0 commit comments

Comments
 (0)