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

Replace gometalinter with golangci-lint #973

Closed
alisondy opened this issue Jul 4, 2019 · 1 comment
Closed

Replace gometalinter with golangci-lint #973

alisondy opened this issue Jul 4, 2019 · 1 comment

Comments

@alisondy
Copy link

alisondy commented Jul 4, 2019

gometalinter has been archived and is no longer being actively maintained. We should consider switching to golangci-lint.

I've installed and run golangci-lint, it runs however there's a few linting errors.

gometalinter had some of lints in the output below disabled by default.

Would like some feedback on whether we should disable the same lints, or fix the issues causing these lints to fail.

time "/Users/alison/go/bin/golangci-lint" run ./pkg/... ./cmd/... ./integration/...
pkg/apis/eksctl.io/v1alpha5/validation.go:10:27   unparam           `validateNodeGroupIAM` - `i` is unused
pkg/nodebootstrap/userdata.go:140:33              unparam           `makeCommonKubeletEnvParams` - `spec` is unused
pkg/kubernetes/manifests.go:44:25                 gocritic          underef: could simplify (*newList).Items to newList.Items
pkg/apis/eksctl.io/v1alpha5/validation.go:219:27  gocritic          captLocal: `SSH' should not be capitalized
pkg/ami/api.go:73:10                              gocritic          elseif: can replace 'else {if cond {}}' with 'else if cond {}'
pkg/cfn/builder/nodegroup.go:75:2                 gocritic          ifElseChain: rewrite if-else to switch statement
pkg/ctl/create/utils.go:44:2                      gocritic          ifElseChain: rewrite if-else to switch statement
pkg/kubernetes/client.go:238:6                    govet             shadow: declaration of "err" shadows declaration at line 229
pkg/kubernetes/client.go:276:6                    govet             shadow: declaration of "err" shadows declaration at line 229
pkg/addons/default/coredns.go:58:10               govet             shadow: declaration of "err" shadows declaration at line 36
pkg/nodebootstrap/userdata.go:112:5               govet             shadow: declaration of "err" shadows declaration at line 104
pkg/cfn/manager/cluster.go:86:5                   govet             shadow: declaration of "err" shadows declaration at line 70
pkg/eks/api.go:177:5                              govet             shadow: declaration of "err" shadows declaration at line 167
pkg/ctl/delete/iamidentitymapping.go:71:5         govet             shadow: declaration of "err" shadows declaration at line 62
pkg/ctl/delete/iamidentitymapping.go:74:5         govet             shadow: declaration of "err" shadows declaration at line 62
pkg/kubernetes/client.go:79:23                    interfacer        `discoveryClient` can be `k8s.io/client-go/discovery.ServerVersionInterface`
pkg/drain/cordon.go:59:66                         interfacer        `scheme` can be `k8s.io/apimachinery/pkg/runtime.ObjectVersioner`
pkg/drain/drain.go:133:55                         golint            exported method GetPodsForDeletion returns unexported type *drain.podDeleteList, which can be annoying to use
pkg/utils/ipnet/ipnet.go:1:46                     misspell          `serialization` is a misspelling of `serialisation`
pkg/utils/ipnet/ipnet.go:21:38                    misspell          `serialization` is a misspelling of `serialisation`
pkg/utils/ipnet/ipnet.go:26:26                    misspell          `serialization` is a misspelling of `serialisation`
pkg/apis/eksctl.io/v1alpha5/types.go:95:37        misspell          `Optimized` is a misspelling of `Optimised`
pkg/ctl/create/cluster.go:343:41                  misspell          `optimized` is a misspelling of `optimised`
pkg/ctl/create/nodegroup.go:177:41                misspell          `optimized` is a misspelling of `optimised`
cmd/eksctl/main.go:40:53                          misspell          `color` is a misspelling of `colour`
cmd/eksctl/main.go:44:14                          misspell          `colored` is a misspelling of `coloured`
cmd/eksctl/main.go:45:3                           misspell          `color` is a misspelling of `colour`
cmd/eksctl/main.go:49:4                           misspell          `color` is a misspelling of `colour`
pkg/apis/eksctl.io/v1alpha5/types.go:435          gofmt             File is not `gofmt`-ed
pkg/cfn/outputs/api.go:28                         gofmt             File is not `gofmt`-ed
pkg/cfn/builder/iam.go:238                        gofmt             File is not `gofmt`-ed
pkg/drain/nodegroup.go:118:27                     scopelint         Using a reference for the variable on range scope `node`
pkg/drain/nodegroup.go:147:42                     scopelint         Using a reference for the variable on range scope `node`
pkg/eks/nodegroup.go:39:19                        scopelint         Using a reference for the variable on range scope `node`
pkg/vpc/cleanup.go:72:25                          scopelint         Using a reference for the variable on range scope `eniID`
pkg/ctl/create/nodegroup.go:25:25                 goconst           string `auto` has 4 occurrences, make it a constant
pkg/kubernetes/client.go:232:4                    ineffassign       ineffectual assignment to `create`
cmd/eksctl/main.go:31:1                           gochecknoinits    don't use `init` function
pkg/kubernetes/scheme.go:9:1                      gochecknoinits    don't use `init` function
pkg/ctl/cmdutils/nodegroup_flags.go:72:19         errcheck          Error return value of `fs.MarkDeprecated` is not checked
pkg/ctl/update/cluster.go:35:20                   errcheck          Error return value of `fs.MarkDeprecated` is not checked
pkg/kubernetes/scheme.go:10:34                    errcheck          Error return value of `apiextensionsv1beta1.AddToScheme` is not checked
pkg/apis/eksctl.io/v1alpha5/register.go:20:2      gochecknoglobals  `SchemeGroupVersion` is a global variable
pkg/apis/eksctl.io/v1alpha5/register.go:21:2      gochecknoglobals  `SchemeBuilder` is a global variable
pkg/apis/eksctl.io/v1alpha5/register.go:22:2      gochecknoglobals  `AddToScheme` is a global variable
cmd/eksctl/main.go:21:5                           gochecknoglobals  `rootCmd` is a global variable
pkg/ami/resolver.go:5:2                           gochecknoglobals  `DefaultResolvers` is a global variable
pkg/cfn/builder/vpc.go:14:5                       gochecknoglobals  `internetCIDR` is a global variable
pkg/cfn/builder/vpc.go:174:2                      gochecknoglobals  `sgProtoTCP` is a global variable
pkg/cfn/builder/vpc.go:175:2                      gochecknoglobals  `sgSourceAnywhereIPv4` is a global variable
pkg/cfn/builder/vpc.go:176:2                      gochecknoglobals  `sgSourceAnywhereIPv6` is a global variable
pkg/cfn/builder/vpc.go:178:2                      gochecknoglobals  `sgPortZero` is a global variable
pkg/cfn/builder/vpc.go:179:2                      gochecknoglobals  `sgMinNodePort` is a global variable
pkg/cfn/builder/vpc.go:180:2                      gochecknoglobals  `sgMaxNodePort` is a global variable
pkg/cfn/builder/vpc.go:182:2                      gochecknoglobals  `sgPortHTTPS` is a global variable
pkg/cfn/builder/vpc.go:183:2                      gochecknoglobals  `sgPortSSH` is a global variable
pkg/cfn/manager/api.go:22:2                       gochecknoglobals  `stackCapabilitiesIAM` is a global variable
pkg/cfn/manager/api.go:23:2                       gochecknoglobals  `stackCapabilitiesNamedIAM` is a global variable
pkg/apis/eksctl.io/v1alpha5/types.go:144:2        gochecknoglobals  `DefaultWaitTimeout` is a global variable
pkg/apis/eksctl.io/v1alpha5/types.go:147:2        gochecknoglobals  `DefaultNodeSSHPublicKeyPath` is a global variable
pkg/apis/eksctl.io/v1alpha5/types.go:150:2        gochecknoglobals  `DefaultNodeVolumeType` is a global variable
pkg/apis/eksctl.io/v1alpha5/types.go:153:2        gochecknoglobals  `DefaultNodeVolumeSize` is a global variable
pkg/version/version.go:16:5                       gochecknoglobals  `info` is a global variable
pkg/ctl/cmdutils/namers.go:16:5                   gochecknoglobals  `r` is a global variable
pkg/utils/kubeconfig/kubeconfig.go:18:5           gochecknoglobals  `DefaultPath` is a global variable
pkg/version/norelease.go:6:2                      gochecknoglobals  `builtAt` is a global variable
pkg/ami/auto_resolver.go:12:5                     gochecknoglobals  `ImageSearchPatterns` is a global variable
pkg/ami/auto_resolver.go:52:5                     gochecknoglobals  `ImageFamilyToAccountID` is a global variable
pkg/authconfigmap/authconfigmap.go:47:5           gochecknoglobals  `RoleNodeGroupGroups` is a global variable
pkg/cfn/builder/iam.go:23:2                       gochecknoglobals  `iamDefaultNodePolicyARNs` is a global variable
pkg/ami/api.go:39:5                               gochecknoglobals  `ImageClasses` is a global variable
pkg/utils/ipnet/ipnet.go:17:5                     gochecknoglobals  `nullString` is a global variable
pkg/utils/ipnet/ipnet.go:18:5                     gochecknoglobals  `nullBytes` is a global variable
pkg/utils/ipnet/ipnet.go:19:5                     gochecknoglobals  `emptyIPNet` is a global variable
pkg/cfn/manager/api.go:72:2                       gosimple          S1011: should replace loop with `input.Tags = append(input.Tags, c.sharedTags...)`
pkg/ctl/cmdutils/nodegroup_filter.go:178:9        gosimple          S1025: the argument is already a string, there's no need to use fmt.Sprintf
pkg/ctl/cmdutils/nodegroup_filter.go:187:9        gosimple          S1025: the argument is already a string, there's no need to use fmt.Sprintf
pkg/ctl/create/utils.go:66:31                     gosimple          S1002: should omit comparison to bool constant, can be simplified to `!*sshConfig.Allow`
pkg/drain/cordon.go:88:12                         staticcheck       SA1019: clientset.Core is deprecated: please explicitly pick a version if possible. 
pkg/utils/ipnet/ipnet.go:42:2                     gosimple          S1023: redundant `return` statement
pkg/utils/kubectl.go:89:21                        stylecheck        ST1005: error strings should not be capitalized
pkg/utils/utils.go:15:5                           gosimple          S1009: should omit nil check; len() for nil slices is defined as zero
pkg/vpc/cleanup.go:78:3                           staticcheck       SA4004: the surrounding loop is unconditionally terminated
pkg/ctl/utils/install_corends.go:16               dupl              16-35 lines are duplicate of `pkg/ctl/utils/update_aws_node.go:14-32`
pkg/ctl/utils/update_aws_node.go:14               dupl              14-32 lines are duplicate of `pkg/ctl/utils/update_coredns.go:14-32`
pkg/ctl/utils/update_coredns.go:14                dupl              14-32 lines are duplicate of `pkg/ctl/utils/update_kube_proxy.go:14-32`
pkg/ctl/utils/update_kube_proxy.go:14             dupl              14-32 lines are duplicate of `pkg/ctl/utils/install_corends.go:16-35`
pkg/nodebootstrap/userdata_al2.go:46              dupl              46-77 lines are duplicate of `pkg/nodebootstrap/userdata_ubuntu.go:42-73`
pkg/nodebootstrap/userdata_ubuntu.go:42           dupl              42-73 lines are duplicate of `pkg/nodebootstrap/userdata_al2.go:46-77`
pkg/ctl/utils/update_aws_node.go:1                dupl              1-75 lines are duplicate of `pkg/ctl/utils/update_coredns.go:1-75`
pkg/ctl/utils/update_coredns.go:1                 dupl              1-75 lines are duplicate of `pkg/ctl/utils/update_aws_node.go:1-75`

real	0m49.226s
user	2m21.742s

Thoughts?

@alisondy alisondy added kind/feature New feature or request kind/explore Ideas worth exploring for future and removed kind/feature New feature or request labels Jul 4, 2019
@errordeveloper
Copy link
Contributor

Thank you! We have tried it before, and there were a few issues. I didn't know gometalinter died... Let's look into this after 0.1.39/0.2.0 is out of the way.

@kalbir kalbir added this to the 0.3.0 milestone Jul 18, 2019
@gemagomez gemagomez modified the milestones: 0.3.0, 0.5.0 Jul 31, 2019
@gemagomez gemagomez removed this from the 0.5.0 milestone Aug 21, 2019
@errordeveloper errordeveloper added technical debt and removed kind/explore Ideas worth exploring for future labels Aug 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants