Skip to content

Commit cc3e67b

Browse files
alexandearldez
andauthored
dev: fix govet.nilness lint issues (#4373)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
1 parent 7cf6cc9 commit cc3e67b

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

.golangci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,16 @@ linters-settings:
5252
- strings.SplitN
5353

5454
govet:
55-
check-shadowing: true
5655
settings:
5756
printf:
5857
funcs:
5958
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
6059
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
6160
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
6261
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
62+
enable:
63+
- nilness
64+
- shadow
6365
errorlint:
6466
asserts: false
6567
lll:

pkg/lint/lintersdb/manager.go

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -236,25 +236,22 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
236236
wrapcheckCfg = &m.cfg.LintersSettings.Wrapcheck
237237
wslCfg = &m.cfg.LintersSettings.WSL
238238

239-
if govetCfg != nil {
240-
govetCfg.Go = m.cfg.Run.Go
241-
}
239+
govetCfg.Go = m.cfg.Run.Go
242240

243-
if gocriticCfg != nil {
244-
gocriticCfg.Go = trimGoVersion(m.cfg.Run.Go)
245-
}
241+
gocriticCfg.Go = trimGoVersion(m.cfg.Run.Go)
246242

247-
if gofumptCfg != nil && gofumptCfg.LangVersion == "" {
243+
if gofumptCfg.LangVersion == "" {
248244
gofumptCfg.LangVersion = m.cfg.Run.Go
249245
}
250246

251-
if staticcheckCfg != nil && staticcheckCfg.GoVersion == "" {
247+
// staticcheck related linters.
248+
if staticcheckCfg.GoVersion == "" {
252249
staticcheckCfg.GoVersion = trimGoVersion(m.cfg.Run.Go)
253250
}
254-
if gosimpleCfg != nil && gosimpleCfg.GoVersion == "" {
251+
if gosimpleCfg.GoVersion == "" {
255252
gosimpleCfg.GoVersion = trimGoVersion(m.cfg.Run.Go)
256253
}
257-
if stylecheckCfg != nil && stylecheckCfg.GoVersion != "" {
254+
if stylecheckCfg.GoVersion != "" {
258255
stylecheckCfg.GoVersion = trimGoVersion(m.cfg.Run.Go)
259256
}
260257
}

0 commit comments

Comments
 (0)