Skip to content

Commit 362b431

Browse files
committed
fix: hide useless warning
1 parent 5a66842 commit 362b431

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
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/config.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func (c *configCommand) preRunE(cmd *cobra.Command, _ []string) error {
8484

8585
// Hack to hide deprecation messages related to `--skip-dirs-use-default`:
8686
// Flags are not bound then the default values, defined only through flags, are not applied.
87-
// In this command, file path and file information are the only requirements, i.e. it don't need flag values.
87+
// In this command, linters information are the only requirements, i.e. it don't need flag values.
8888
//
8989
// TODO(ldez) add an option (check deprecation) to `Loader.Load()` but this require a dedicated PR.
9090
cfg.Run.UseDefaultSkipDirs = true

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, file path and file 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)