Skip to content

Commit 270a1db

Browse files
committed
fix: ignore warn.
1 parent 66adcf6 commit 270a1db

File tree

6 files changed

+18
-9
lines changed

6 files changed

+18
-9
lines changed

.golangci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ linters:
8888
- gosimple
8989
- govet
9090
- ineffassign
91-
- interfacer
9291
- lll
9392
- misspell
9493
- nakedret
@@ -113,6 +112,7 @@ linters:
113112
# - godot
114113
# - godox
115114
# - goerr113
115+
# - interfacer
116116
# - maligned
117117
# - nestif
118118
# - prealloc

pkg/commands/run.go

+5
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,11 @@ func initFlagSet(fs *pflag.FlagSet, cfg *config.Config, m *lintersdb.Manager, is
206206
"them. This option implies option --disable-all", strings.Join(m.AllPresets(), "|"))))
207207
fs.BoolVar(&lc.Fast, "fast", false, wh("Run only fast linters from enabled linters set (first run won't be fast)"))
208208

209+
fs.BoolVar(&cfg.InternalCmdTest, "internal-cmd-test", false, wh("TODO")) // FIXME
210+
if err := fs.MarkHidden("internal-cmd-test"); err != nil {
211+
panic(err)
212+
}
213+
209214
// Issues config
210215
ic := &cfg.Issues
211216
fs.StringSliceVarP(&ic.ExcludePatterns, "exclude", "e", nil, wh("Exclude issue by regexp"))

pkg/config/config.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,8 @@ type Config struct {
663663
Severity Severity
664664
Version Version
665665

666-
InternalTest bool // Option is used only for testing golangci-lint code, don't use it
666+
InternalCmdTest bool `mapstructure:"internal-cmd-test"` // Option is used only for testing golangci-lint command, don't use it
667+
InternalTest bool // Option is used only for testing golangci-lint code, don't use it
667668
}
668669

669670
func NewDefault() *Config {

pkg/lint/runner.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"strings"
99

1010
"github.com/pkg/errors"
11+
gopackages "golang.org/x/tools/go/packages"
1112

1213
"github.com/golangci/golangci-lint/internal/errorutil"
1314
"github.com/golangci/golangci-lint/pkg/config"
@@ -20,8 +21,6 @@ import (
2021
"github.com/golangci/golangci-lint/pkg/result"
2122
"github.com/golangci/golangci-lint/pkg/result/processors"
2223
"github.com/golangci/golangci-lint/pkg/timeutils"
23-
24-
gopackages "golang.org/x/tools/go/packages"
2524
)
2625

2726
type Runner struct {
@@ -51,9 +50,11 @@ func NewRunner(cfg *config.Config, log logutils.Log, goenv *goutil.Env, es *lint
5150
}
5251

5352
// print deprecated messages
54-
for name, lc := range enabledLinters {
55-
if lc.IsDeprecated() {
56-
log.Warnf("The linter '%s' is deprecated due to: %s", name, lc.DeprecatedMessage)
53+
if !cfg.InternalCmdTest {
54+
for name, lc := range enabledLinters {
55+
if lc.IsDeprecated() {
56+
log.Warnf("The linter '%s' is deprecated due to: %s", name, lc.DeprecatedMessage)
57+
}
5758
}
5859
}
5960

test/testdata/interfacer.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//args: -Einterfacer
1+
//args: -Einterfacer --internal-cmd-test
22
package testdata
33

44
import "io"

test/testshared/testshared.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ func (r *LintRunner) Run(args ...string) *RunResult {
9494
func (r *LintRunner) RunCommand(command string, args ...string) *RunResult {
9595
r.Install()
9696

97-
runArgs := append([]string{command}, args...)
97+
runArgs := append([]string{command}, "--internal-cmd-test")
98+
runArgs = append(runArgs, args...)
99+
98100
defer func(startedAt time.Time) {
99101
r.log.Infof("ran [../golangci-lint %s] in %s", strings.Join(runArgs, " "), time.Since(startedAt))
100102
}(time.Now())

0 commit comments

Comments
 (0)