Skip to content

Commit 77a8601

Browse files
authored
fix: hide useless warning (#4587)
1 parent 5a66842 commit 77a8601

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

.golangci.yml

+4
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,11 @@ issues:
160160
linters: [staticcheck]
161161
text: "SA1019: c.cfg.Run.ShowStats is deprecated: use Output.ShowStats instead."
162162
- path: pkg/commands/config.go
163+
linters: [staticcheck]
163164
text: "SA1019: cfg.Run.UseDefaultSkipDirs is deprecated: use Issues.UseDefaultExcludeDirs instead."
165+
- path: pkg/commands/linters.go
166+
linters: [staticcheck]
167+
text: "SA1019: c.cfg.Run.UseDefaultSkipDirs is deprecated: use Issues.UseDefaultExcludeDirs instead."
164168

165169
# Deprecated linter options.
166170
- path: pkg/golinters/errcheck.go

pkg/commands/linters.go

+7
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ func newLintersCommand(logger logutils.Log) *lintersCommand {
5959
}
6060

6161
func (c *lintersCommand) preRunE(cmd *cobra.Command, _ []string) error {
62+
// Hack to hide deprecation messages related to `--skip-dirs-use-default`:
63+
// Flags are not bound then the default values, defined only through flags, are not applied.
64+
// In this command, linters information are the only requirements, i.e. it don't need flag values.
65+
//
66+
// TODO(ldez) add an option (check deprecation) to `Loader.Load()` but this require a dedicated PR.
67+
c.cfg.Run.UseDefaultSkipDirs = true
68+
6269
loader := config.NewLoader(c.log.Child(logutils.DebugKeyConfigReader), c.viper, cmd.Flags(), c.opts.LoaderOptions, c.cfg)
6370

6471
if err := loader.Load(); err != nil {

0 commit comments

Comments
 (0)