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

✨ Update to golangci-lint v1.18.0 #1415

Merged
merged 4 commits into from
Sep 12, 2019
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
34 changes: 15 additions & 19 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
linters:
enable:
- govet
- golint
- gofmt
- goimports
- structcheck
- varcheck
- interfacer
- unconvert
- ineffassign
- goconst
- gocyclo
- misspell
- nakedret
- prealloc
- gosec
disable-all: true
enable-all: true
disable:
- dupl
- errcheck
- funlen
- gochecknoglobals
- gochecknoinits
- gocritic
- lll
- scopelint
- staticcheck
- unparam
- unused
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to see if we can shorten this list. Ideally, I'd like to see if we can get down to just disabling dupl, gochecknoglobals, gochecknoinits, gocyclo, and lll, otherwise this lgtm

Copy link
Contributor Author

@tpounds tpounds Sep 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@detiber Agree. I tried enabling a few others but they are all pretty noisy right now. I figured this was a good starting point to at least document which linters are disabled and let someone take a stab at pruning this list over time.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sgtm

# Run with --fast=false for more extensive checks
fast: true
issue:
issues:
max-same-issues: 0
max-per-linter: 0
max-issues-per-linter: 0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@detiber FYI I just added a commit to address this incorrect option.

run:
deadline: 2m
skip-files:
Expand Down
16 changes: 4 additions & 12 deletions cmd/clusterctl/phases/pivot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,7 @@ func (s *sourcer) GetClusters(ns string) ([]*clusterv1.Cluster, error) {
if ns == "" {
out := []*clusterv1.Cluster{}
for _, clusters := range s.clusters {
for _, cluster := range clusters {
out = append(out, cluster)
}
out = append(out, clusters...)
}
return out, nil
}
Expand All @@ -324,9 +322,7 @@ func (s *sourcer) GetMachineDeployments(ns string) ([]*clusterv1.MachineDeployme
if ns == "" {
out := []*clusterv1.MachineDeployment{}
for _, mds := range s.machineDeployments {
for _, md := range mds {
out = append(out, md)
}
out = append(out, mds...)
}
return out, nil
}
Expand All @@ -348,9 +344,7 @@ func (s *sourcer) GetMachines(ns string) ([]*clusterv1.Machine, error) {
if ns == "" {
out := []*clusterv1.Machine{}
for _, machines := range s.machines {
for _, m := range machines {
out = append(out, m)
}
out = append(out, machines...)
}
return out, nil
}
Expand All @@ -362,9 +356,7 @@ func (s *sourcer) GetMachineSets(ns string) ([]*clusterv1.MachineSet, error) {
if ns == "" {
out := []*clusterv1.MachineSet{}
for _, machineSets := range s.machineSets {
for _, ms := range machineSets {
out = append(out, ms)
}
out = append(out, machineSets...)
}
return out, nil
}
Expand Down
20 changes: 1 addition & 19 deletions hack/tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,9 @@ module sigs.k8s.io/cluster-api/hack/tools
go 1.12

require (
github.com/golang/mock v1.3.1 // indirect
github.com/golang/protobuf v1.3.2 // indirect
github.com/golangci/golangci-lint v1.17.1
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0 // indirect
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0 // indirect
github.com/golangci/golangci-lint v1.18.0
k8s.io/code-generator v0.0.0-20190831074504-732c9ca86353
sigs.k8s.io/controller-tools v0.2.0
sigs.k8s.io/kubebuilder/docs/book/utils v0.0.0-20190903174343-de03361a00cb
sigs.k8s.io/testing_frameworks v0.1.1
)

replace (
// TODO(vincepri) Remove the following replace directives, needed for golangci-lint until
// https://github.com/golangci/golangci-lint/issues/595 is fixed.
github.com/go-critic/go-critic v0.0.0-20181204210945-1df300866540 => github.com/go-critic/go-critic v0.0.0-20190526074819-1df300866540
github.com/golangci/errcheck v0.0.0-20181003203344-ef45e06d44b6 => github.com/golangci/errcheck v0.0.0-20181223084120-ef45e06d44b6
github.com/golangci/go-tools v0.0.0-20180109140146-af6baa5dc196 => github.com/golangci/go-tools v0.0.0-20190318060251-af6baa5dc196
github.com/golangci/gofmt v0.0.0-20181105071733-0b8337e80d98 => github.com/golangci/gofmt v0.0.0-20181222123516-0b8337e80d98
github.com/golangci/gosec v0.0.0-20180901114220-66fb7fc33547 => github.com/golangci/gosec v0.0.0-20190211064107-66fb7fc33547
github.com/golangci/ineffassign v0.0.0-20180808204949-42439a7714cc => github.com/golangci/ineffassign v0.0.0-20190609212857-42439a7714cc
github.com/golangci/lint-1 v0.0.0-20180610141402-ee948d087217 => github.com/golangci/lint-1 v0.0.0-20190420132249-ee948d087217
github.com/timakin/bodyclose => github.com/golangci/bodyclose v0.0.0-20190714144026-65da19158fa2
mvdan.cc/unparam v0.0.0-20190124213536-fbb59629db34 => mvdan.cc/unparam v0.0.0-20190209190245-fbb59629db34
)
Loading