From c41132a4f68eff7673140bef158f55b42db2128d Mon Sep 17 00:00:00 2001 From: Manfred Touron Date: Sun, 20 Jan 2019 06:58:14 +0100 Subject: [PATCH] chore: switch to golangci-lint --- .golangci.yml | 34 ++++++++++++++++++++++++++++++++++ .travis.yml | 5 ++--- Makefile | 2 +- assets/assets | 6 ++++++ encoder.go | 2 +- main.go | 2 +- 6 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 .golangci.yml create mode 100644 assets/assets diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..cf01fa4 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,34 @@ +run: + deadline: 1m + tests: false + #skip-files: + # - ".*\\.gen\\.go" + +linters-settings: + golint: + min-confidence: 0 + maligned: + suggest-new: true + goconst: + min-len: 5 + min-occurrences: 4 + misspell: + locale: US + +linters: + disable-all: true + enable: + - goconst + - misspell + - deadcode + - misspell + - structcheck + - errcheck + - unused + - varcheck + - staticcheck + - unconvert + - gofmt + - goimports + - golint + - ineffassign diff --git a/.travis.yml b/.travis.yml index 8abbc91..95d4621 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,12 +6,11 @@ install: - wget https://raw.githubusercontent.com/grpc-ecosystem/grpc-gateway/v1.5.0/.travis/install-protoc.sh && chmod +x install-protoc.sh && ./install-protoc.sh 3.4.0 - go get -u github.com/golang/protobuf/protoc-gen-go - go get github.com/securego/gosec/cmd/gosec/... -- go get -u github.com/alecthomas/gometalinter -- gometalinter --install +- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.12.2 script: - make install - make test -- make lint +- PATH=$PATH:$(pwd)/bin make lint cache: directories: - $HOME/local diff --git a/Makefile b/Makefile index 694b0b0..7395147 100644 --- a/Makefile +++ b/Makefile @@ -33,4 +33,4 @@ docker.push: docker.build .PHONY: lint lint: - gometalinter --disable-all --enable=errcheck --enable=vet --enable=vetshadow --enable=golint --enable=gosec --enable=ineffassign --enable=goconst --enable=goimports --enable=gofmt --exclude="Binds to all network interfaces" --exclude="should have comment" --enable=staticcheck --enable=gosimple --enable=misspell --deadline=120s . ./cmd/... ./helpers/... + golangci-lint run --verbose . ./helpers ./cmd/... diff --git a/assets/assets b/assets/assets new file mode 100644 index 0000000..8247d2f --- /dev/null +++ b/assets/assets @@ -0,0 +1,6 @@ + /Users/moul/go/src/moul.io/protoc-gen-gotemplate/assets: + total used in directory 552 available 9223372036849978910 + drwxr-xr-x 4 moul staff 128 Dec 9 11:31 . + lrwxr-xr-x 1 moul staff 33 Dec 9 11:31 .#web-editor.jpg -> moul@manfred-spacegray.local.9471 + drwxr-xr-x 21 moul staff 672 Sep 13 18:05 .. + -rw-r--r--@ 1 moul staff 280357 Oct 26 2017 web-editor.jpg diff --git a/encoder.go b/encoder.go index 2be60b8..713f459 100644 --- a/encoder.go +++ b/encoder.go @@ -11,7 +11,7 @@ import ( "time" "github.com/golang/protobuf/protoc-gen-go/descriptor" - "github.com/golang/protobuf/protoc-gen-go/plugin" + plugin_go "github.com/golang/protobuf/protoc-gen-go/plugin" pgghelpers "moul.io/protoc-gen-gotemplate/helpers" ) diff --git a/main.go b/main.go index 00a67a1..dea8384 100644 --- a/main.go +++ b/main.go @@ -8,7 +8,7 @@ import ( "github.com/golang/protobuf/proto" "github.com/golang/protobuf/protoc-gen-go/generator" - "github.com/golang/protobuf/protoc-gen-go/plugin" + plugin_go "github.com/golang/protobuf/protoc-gen-go/plugin" ggdescriptor "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor" pgghelpers "moul.io/protoc-gen-gotemplate/helpers"