Skip to content

Commit

Permalink
dev: fix govet.nilness lint issues (#4373)
Browse files Browse the repository at this point in the history
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
  • Loading branch information
alexandear and ldez authored Feb 10, 2024
1 parent 7cf6cc9 commit cc3e67b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
4 changes: 3 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,16 @@ linters-settings:
- strings.SplitN

govet:
check-shadowing: true
settings:
printf:
funcs:
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
enable:
- nilness
- shadow
errorlint:
asserts: false
lll:
Expand Down
17 changes: 7 additions & 10 deletions pkg/lint/lintersdb/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,25 +236,22 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
wrapcheckCfg = &m.cfg.LintersSettings.Wrapcheck
wslCfg = &m.cfg.LintersSettings.WSL

if govetCfg != nil {
govetCfg.Go = m.cfg.Run.Go
}
govetCfg.Go = m.cfg.Run.Go

if gocriticCfg != nil {
gocriticCfg.Go = trimGoVersion(m.cfg.Run.Go)
}
gocriticCfg.Go = trimGoVersion(m.cfg.Run.Go)

if gofumptCfg != nil && gofumptCfg.LangVersion == "" {
if gofumptCfg.LangVersion == "" {
gofumptCfg.LangVersion = m.cfg.Run.Go
}

if staticcheckCfg != nil && staticcheckCfg.GoVersion == "" {
// staticcheck related linters.
if staticcheckCfg.GoVersion == "" {
staticcheckCfg.GoVersion = trimGoVersion(m.cfg.Run.Go)
}
if gosimpleCfg != nil && gosimpleCfg.GoVersion == "" {
if gosimpleCfg.GoVersion == "" {
gosimpleCfg.GoVersion = trimGoVersion(m.cfg.Run.Go)
}
if stylecheckCfg != nil && stylecheckCfg.GoVersion != "" {
if stylecheckCfg.GoVersion != "" {
stylecheckCfg.GoVersion = trimGoVersion(m.cfg.Run.Go)
}
}
Expand Down

0 comments on commit cc3e67b

Please sign in to comment.