Skip to content

Commit

Permalink
Replace individual linters with golangci-lint
Browse files Browse the repository at this point in the history
Add .golangci.yml config file for golangci-lint. Simplify the Travis config and
Gopkg.toml because now there is only one linter to go get. Don't vendor
golangci-lint because dep fetches the wrong versions of golangci-lint's
dependencies.
  • Loading branch information
ryboe authored and Ryan Boehning committed May 26, 2018
1 parent cb1faea commit 4b5d05b
Show file tree
Hide file tree
Showing 113 changed files with 32 additions and 31,655 deletions.
19 changes: 19 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
run:
deadline: 1h
tests: true

linters:
enable:
- gocyclo
- gofmt
- golint

linters-settings:
gocyclo:
min-complexity: 11

gofmt:
simplify: true

golint:
min-confidence: 0.25 # ignore missing package comment false positive
20 changes: 3 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,10 @@ install: true
notifications:
email: false

# install code checkers
# install linter
before_script:
- cd vendor/golang.org/x/lint/golint
- go install
- cd -
- cd vendor/honnef.co/go/tools/cmd/megacheck
- go install
- cd -
- cd vendor/github.com/fzipp/gocyclo
- go install
- cd -
- go get -u github.com/golangci/golangci-lint/cmd/golangci-lint

script:
- GO_FILES=$(find . -iname '*.go' -type f | grep -v /vendor/)
- test -z $(gofmt -s -l ${GO_FILES})
- golangci-lint --concurrency $(nproc) run
- go test -v -race ./...
- go vet ./...
- megacheck ./...
# golint ./... doesn't ignore vendor/ for some dumb reason
- golint -set_exit_status $(go list ./... | grep -v /vendor/)
- gocyclo -over 10 ${GO_FILES}
69 changes: 5 additions & 64 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 5 additions & 16 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
required = [
"github.com/fzipp/gocyclo",
"golang.org/x/lint",
"golang.org/x/lint/golint",
"honnef.co/go/tools/cmd/megacheck",
]

[[constraint]]
name = "github.com/fzipp/gocyclo"
branch = "master"

[[constraint]]
name = "golang.org/x/lint"
branch = "master"
name = "github.com/kr/pretty"
version = "^0.1.0"

[prune]
go-tests = true
non-go = true
unused-packages = true
go-tests = true
non-go = true
unused-packages = true
7 changes: 0 additions & 7 deletions vendor/github.com/fzipp/gocyclo/CONTRIBUTORS

This file was deleted.

27 changes: 0 additions & 27 deletions vendor/github.com/fzipp/gocyclo/LICENSE

This file was deleted.

Loading

0 comments on commit 4b5d05b

Please sign in to comment.