Skip to content

Commit

Permalink
fix: ignore warn.
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Feb 20, 2021
1 parent 66adcf6 commit 270a1db
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ linters:
- gosimple
- govet
- ineffassign
- interfacer
- lll
- misspell
- nakedret
Expand All @@ -113,6 +112,7 @@ linters:
# - godot
# - godox
# - goerr113
# - interfacer
# - maligned
# - nestif
# - prealloc
Expand Down
5 changes: 5 additions & 0 deletions pkg/commands/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,11 @@ func initFlagSet(fs *pflag.FlagSet, cfg *config.Config, m *lintersdb.Manager, is
"them. This option implies option --disable-all", strings.Join(m.AllPresets(), "|"))))
fs.BoolVar(&lc.Fast, "fast", false, wh("Run only fast linters from enabled linters set (first run won't be fast)"))

fs.BoolVar(&cfg.InternalCmdTest, "internal-cmd-test", false, wh("TODO")) // FIXME
if err := fs.MarkHidden("internal-cmd-test"); err != nil {
panic(err)
}

// Issues config
ic := &cfg.Issues
fs.StringSliceVarP(&ic.ExcludePatterns, "exclude", "e", nil, wh("Exclude issue by regexp"))
Expand Down
3 changes: 2 additions & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,8 @@ type Config struct {
Severity Severity
Version Version

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

func NewDefault() *Config {
Expand Down
11 changes: 6 additions & 5 deletions pkg/lint/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"strings"

"github.com/pkg/errors"
gopackages "golang.org/x/tools/go/packages"

"github.com/golangci/golangci-lint/internal/errorutil"
"github.com/golangci/golangci-lint/pkg/config"
Expand All @@ -20,8 +21,6 @@ import (
"github.com/golangci/golangci-lint/pkg/result"
"github.com/golangci/golangci-lint/pkg/result/processors"
"github.com/golangci/golangci-lint/pkg/timeutils"

gopackages "golang.org/x/tools/go/packages"
)

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

// print deprecated messages
for name, lc := range enabledLinters {
if lc.IsDeprecated() {
log.Warnf("The linter '%s' is deprecated due to: %s", name, lc.DeprecatedMessage)
if !cfg.InternalCmdTest {
for name, lc := range enabledLinters {
if lc.IsDeprecated() {
log.Warnf("The linter '%s' is deprecated due to: %s", name, lc.DeprecatedMessage)
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/testdata/interfacer.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//args: -Einterfacer
//args: -Einterfacer --internal-cmd-test
package testdata

import "io"
Expand Down
4 changes: 3 additions & 1 deletion test/testshared/testshared.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ func (r *LintRunner) Run(args ...string) *RunResult {
func (r *LintRunner) RunCommand(command string, args ...string) *RunResult {
r.Install()

runArgs := append([]string{command}, args...)
runArgs := append([]string{command}, "--internal-cmd-test")
runArgs = append(runArgs, args...)

defer func(startedAt time.Time) {
r.log.Infof("ran [../golangci-lint %s] in %s", strings.Join(runArgs, " "), time.Since(startedAt))
}(time.Now())
Expand Down

0 comments on commit 270a1db

Please sign in to comment.