Skip to content

Commit

Permalink
Merge pull request #1443 from sayboras/feature/golangci-lint
Browse files Browse the repository at this point in the history
Migrate to golangci-lint
  • Loading branch information
martina-if authored Jan 9, 2020
2 parents 24717cd + 4ceaccd commit cfc50ff
Show file tree
Hide file tree
Showing 30 changed files with 296 additions and 115 deletions.
7 changes: 4 additions & 3 deletions .docker/build_image_manifest
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
"github.com/kevinburke/go-bindata v3.15.0+incompatible"
"github.com/vektra/mockery v0.0.0-20181123154057-e78b021dcbb5"
"github.com/weaveworks/github-release v0.6.2"
"golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac"
"golang.org/x/tools v0.0.0-20191010075000-0337d82405ff"
"k8s.io/code-generator v0.0.0-20190831074504-732c9ca86353"
"k8s.io/code-generator v0.0.0-20190831074504-732c9ca86353"
"k8s.io/code-generator v0.0.0-20190831074504-732c9ca86353"
"k8s.io/code-generator v0.0.0-20190831074504-732c9ca86353"
"k8s.io/code-generator v0.0.0-20190831074504-732c9ca86353"
"github.com/golangci/golangci-lint v1.21.0"
100644 blob bb0ec393bec64fc65e97fde82edcbc22935f42bd Dockerfile
100644 blob 5377f63387890fa432473075d18c2a9cd23fcbd9 .requirements
100755 blob 63eeb505fa28cdddfd37b150c6e3c8103f791c02 install-build-deps.sh
100644 blob 07cb4cecc51d2b5015230d01a1ab699d6969dd56 .requirements
100755 blob 7b867a5b4a1ea544385441ecf9c1c1e5a1cce7e1 install-build-deps.sh
2 changes: 1 addition & 1 deletion .docker/image_tag
Original file line number Diff line number Diff line change
@@ -1 +1 @@
15647ccf908a62f62a0539cad240b1f23bcf524d
9967465486cdded70c8609524c322c47f950955f
36 changes: 25 additions & 11 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ run:
concurrency: 4

# timeout for analysis, e.g. 30s, 5m, default is 1m
deadline: 5m
timeout: 5m

# exit code when at least one issue was found, default is 1
issues-exit-code: 1
Expand All @@ -27,6 +27,7 @@ run:
- ^pkg\/eks\/mocks$
- \/usr\/local\/go
- ^pkg\/testutils
- ^pkg\/drain

# which files to skip: they will be analyzed, but issues from them
# won't be reported. Default value is empty list, but there is
Expand All @@ -35,7 +36,12 @@ run:
skip-files:
# - ".*\\.my\\.go$"
# - lib/bad.go
- pkg/nodebootstrap/assets.go
- ^pkg\/nodebootstrap\/assets.go
- ^pkg\/testutils\/(ginkgo|client).go
- ^pkg\/testutils\/mockprovider\/mock_provider.go
- ^pkg\/cfn\/template\/matchers\/matchers.go
- ^integration\/matchers\/matchers.go
- ^integration\/runner\/runner.go


# output configuration options
Expand All @@ -62,7 +68,7 @@ linters-settings:
check-blank: false
govet:
# report about shadowed variables
check-shadowing: true
check-shadowing: false

# Obtain type information from installed (to $GOPATH/pkg) package files:
# golangci-lint will execute `go install -i` and `go test -i` for analyzed packages
Expand Down Expand Up @@ -106,7 +112,7 @@ linters-settings:
# Correct spellings using locale preferences for US or UK.
# Default is to use a neutral variety of English.
# Setting locale to US will correct the British spelling of 'colour' to 'color'.
locale: UK
locale: default
lll:
# max line length, lines longer will be reported. Default is 120.
# '\t' is counted as 1 character by default, and can be changed with the tab-width option
Expand Down Expand Up @@ -144,11 +150,19 @@ linters-settings:


linters:
enable-all: true
disable:
disable-all: true
enable:
- gofmt
- unused
- govet
- golint
- errcheck
- deadcode
- misspell
- goimports
- maligned
- prealloc
- gocyclo # TODO: enable this in the future
- lll #TODO: enable this in the future
- gosec #TODO: enable this in the future
# TODO: enable the below linter in the future
# - maligned
# - prealloc
# - gocyclo
# - lll
# - gosec
21 changes: 0 additions & 21 deletions .gometalinter.json

This file was deleted.

1 change: 1 addition & 0 deletions .requirements
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ k8s.io/code-generator/cmd/deepcopy-gen
k8s.io/code-generator/cmd/defaulter-gen
k8s.io/code-generator/cmd/informer-gen
k8s.io/code-generator/cmd/lister-gen
github.com/golangci/golangci-lint/cmd/golangci-lint
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ endif

.PHONY: lint
lint: ## Run linter over the codebase
time "$(GOBIN)/gometalinter" ./pkg/... ./cmd/... ./integration/...
time "$(GOBIN)/golangci-lint" run

.PHONY: test
test:
Expand Down
7 changes: 4 additions & 3 deletions cmd/schema/generate.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package main

import (
"github.com/alecthomas/jsonschema"
api "github.com/weaveworks/eksctl/pkg/apis/eksctl.io/v1alpha5"
"io/ioutil"
"os"
"sigs.k8s.io/yaml"
"strings"

"github.com/alecthomas/jsonschema"
api "github.com/weaveworks/eksctl/pkg/apis/eksctl.io/v1alpha5"
"sigs.k8s.io/yaml"
)

func main() {
Expand Down
17 changes: 7 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ require (
github.com/gobwas/glob v0.2.3
github.com/gofrs/flock v0.7.1 // indirect
github.com/gohugoio/hugo v0.55.6
github.com/google/btree v1.0.0 // indirect
github.com/golangci/golangci-lint v1.21.0
github.com/google/certificate-transparency-go v1.0.21 // indirect
github.com/goreleaser/goreleaser v0.110.0
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
Expand All @@ -48,24 +48,23 @@ require (
github.com/magiconair/properties v1.8.1 // indirect
github.com/mattn/go-zglob v0.0.1 // indirect
github.com/miekg/coredns v0.0.0-20170910182647-1b60688dc8f7 // indirect
github.com/onsi/ginkgo v1.8.0
github.com/onsi/gomega v1.5.0
github.com/onsi/ginkgo v1.10.1
github.com/onsi/gomega v1.7.0
github.com/pelletier/go-toml v1.4.0 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pkg/errors v0.8.1
github.com/pkg/sftp v1.8.3 // indirect
github.com/riywo/loginshell v0.0.0-20190610082906-2ed199a032f6
github.com/sanathkr/yaml v1.0.0 // indirect
github.com/sirupsen/logrus v1.4.2 // indirect

github.com/spf13/afero v1.2.2

github.com/spf13/cobra v0.0.4
github.com/spf13/cobra v0.0.5

github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.3.2
github.com/spf13/viper v1.4.0
github.com/spotinst/spotinst-sdk-go v0.0.0-20181012192533-fed4677dbf8f // indirect
github.com/stretchr/testify v1.3.0
github.com/stretchr/testify v1.4.0
github.com/tidwall/gjson v1.1.3
github.com/tidwall/match v1.0.0 // indirect
github.com/tidwall/sjson v1.0.2
Expand All @@ -77,9 +76,7 @@ require (
github.com/whilp/git-urls v0.0.0-20160530060445-31bac0d230fa
github.com/zmap/zlint v0.0.0-20190806182416-88c3f6b6f2f5 // indirect
go.etcd.io/bbolt v1.3.3 // indirect
go.uber.org/atomic v1.4.0 // indirect
go.uber.org/zap v1.10.0 // indirect
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac
golang.org/x/tools v0.0.0-20191010075000-0337d82405ff
google.golang.org/grpc v1.21.1 // indirect
gopkg.in/gcfg.v1 v1.2.3 // indirect
gopkg.in/ini.v1 v1.42.0 // indirect
Expand Down
Loading

0 comments on commit cfc50ff

Please sign in to comment.