diff --git a/.golangci.toml b/.golangci.toml new file mode 100644 index 0000000..182b8fe --- /dev/null +++ b/.golangci.toml @@ -0,0 +1,45 @@ +[run] + concurrency = 4 + tests = false + +[linters-settings] + [linters-settings.gocyclo] + min-complexity = 20 + + [linters-settings.goconst] + min-len = 2 + min-occurrences = 2 + + [linters-settings.misspell] + locale = "US" + +[linters] + # White-listing, to be more CI safe. + disable-all = true + + # @see https://github.com/golangci/golangci-lint#enabled-by-default-linters + enable = [ + "staticcheck", + "gosimple", + "ineffassign", + "typecheck", + "govet", +# "errcheck", + "unused", + "structcheck", + "varcheck", + "deadcode", + + "stylecheck", + "gosec", + "interfacer", + "unconvert", +# "goconst", + "gocyclo", +# "maligned", + "depguard", + "misspell", + "unparam", + "scopelint", # Would like to ignore *_test.go files, but can't atm. + "gocritic", + ] diff --git a/.gometalinter.json b/.gometalinter.json deleted file mode 100644 index 0fcd2b0..0000000 --- a/.gometalinter.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "Cyclo": 10, - "Deadline": "5m", - "Vendor": true, - "Test": true, - "EnableAll": false, - "Checkstyle": false, - "Errors": false, - "Enable": [ - "deadcode", - "dupl", - "errcheck", - "gochecknoglobals", - "gochecknoinits", - "goconst", - "gofmt", - "gotypex", - "goimports", - "golint", - "gosec", - "ineffassign", - "interfacer", - "staticcheck", - "misspell", - "nakedret", - "test", - "testify", - "unconvert", - "unparam", - "vetshadow", - "staticcheck" - ], - "Disable": [ - "gochecknoglobals", - "gochecknoinits", - "dupl" - ], - "Exclude": [ - "vendor/.*", - "by package bimg", - "Errors unhandled", - "Potential file inclusion via variable", - "should have comment" - ] -} diff --git a/Dockerfile b/Dockerfile index c03fad4..a4e3f4a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,9 +33,10 @@ RUN DEBIAN_FRONTEND=noninteractive \ ldconfig && \ GO111MODULE=off go get -u github.com/golang/dep/cmd/dep -# Installing gometalinter +# Installing golangci-lint WORKDIR /tmp -RUN curl -fsSL https://git.io/vp6lP -o instgm.sh && chmod u+x instgm.sh && ./instgm.sh -b "${GOPATH}/bin" +RUN curl -fsSL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "${GOPATH}/bin" v1.16.0 + WORKDIR ${GOPATH}/src/github.com/h2non/imaginary @@ -47,7 +48,7 @@ RUN rm -rf vendor && dep ensure # Run quality control RUN GO111MODULE=off go test -test.v -test.race -test.covermode=atomic ./... -RUN GO111MODULE=off gometalinter github.com/h2non/imaginary +RUN GO111MODULE=off golangci-lint run ./... # Compile imaginary RUN GO111MODULE=off go build -a \