chore: switch to golangci-lint

This commit is contained in:
Manfred Touron 2019-01-20 06:58:14 +01:00
parent 36f4177b68
commit c41132a4f6
No known key found for this signature in database
GPG Key ID: 6D4DED2EAB123456
6 changed files with 45 additions and 6 deletions

34
.golangci.yml Normal file
View File

@ -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

View File

@ -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 - 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 -u github.com/golang/protobuf/protoc-gen-go
- go get github.com/securego/gosec/cmd/gosec/... - go get github.com/securego/gosec/cmd/gosec/...
- go get -u github.com/alecthomas/gometalinter - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.12.2
- gometalinter --install
script: script:
- make install - make install
- make test - make test
- make lint - PATH=$PATH:$(pwd)/bin make lint
cache: cache:
directories: directories:
- $HOME/local - $HOME/local

View File

@ -33,4 +33,4 @@ docker.push: docker.build
.PHONY: lint .PHONY: lint
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/...

6
assets/assets Normal file
View File

@ -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

View File

@ -11,7 +11,7 @@ import (
"time" "time"
"github.com/golang/protobuf/protoc-gen-go/descriptor" "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" pgghelpers "moul.io/protoc-gen-gotemplate/helpers"
) )

View File

@ -8,7 +8,7 @@ import (
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
"github.com/golang/protobuf/protoc-gen-go/generator" "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" ggdescriptor "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway/descriptor"
pgghelpers "moul.io/protoc-gen-gotemplate/helpers" pgghelpers "moul.io/protoc-gen-gotemplate/helpers"