Skip to content

Commit 38b7222

Browse files
committed
fix: hack to hide deprecation message
1 parent fef593e commit 38b7222

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.golangci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ issues:
155155
- path: pkg/commands/run.go
156156
linters: [staticcheck]
157157
text: "SA1019: c.cfg.Run.ShowStats is deprecated: use Output.ShowStats instead."
158+
- path: pkg/commands/config.go
159+
text: "SA1019: cfg.Run.UseDefaultSkipDirs is deprecated: use Issues.UseDefaultExcludeDirs instead."
158160

159161
- path: pkg/golinters/gofumpt.go
160162
linters: [staticcheck]

pkg/commands/config.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,16 @@ func newConfigCommand(log logutils.Log, info BuildInfo) *configCommand {
8585
func (c *configCommand) preRunE(cmd *cobra.Command, _ []string) error {
8686
// The command doesn't depend on the real configuration.
8787
// It only needs to know the path of the configuration file.
88-
loader := config.NewLoader(c.log.Child(logutils.DebugKeyConfigReader), c.viper, cmd.Flags(), c.opts, config.NewDefault())
88+
cfg := config.NewDefault()
89+
90+
// Hack to hide deprecation messages related to `--skip-dirs-use-default`:
91+
// Flags are not bound then the default values, defined only through flags, are not applied.
92+
// In this command, file path and file information are the only requirements, i.e. it don't need flag values.
93+
//
94+
// TODO(ldez) add an option (check deprecation) to `Loader.Load()` but this require a dedicated PR.
95+
cfg.Run.UseDefaultSkipDirs = true
96+
97+
loader := config.NewLoader(c.log.Child(logutils.DebugKeyConfigReader), c.viper, cmd.Flags(), c.opts, cfg)
8998

9099
if err := loader.Load(); err != nil {
91100
return fmt.Errorf("can't load config: %w", err)

0 commit comments

Comments
 (0)