Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev: fix govet.nilness lint issues #4373

Merged
merged 2 commits into from
Feb 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading