makefile: switched to golangci-lint
This commit is contained in:
51
Makefile
51
Makefile
@@ -1,35 +1,44 @@
|
||||
all: check test bench
|
||||
|
||||
ifndef GOBIN
|
||||
export GOBIN := $(GOPATH)/bin
|
||||
endif
|
||||
|
||||
.PHONY: fmt
|
||||
fmt: ## Format source code
|
||||
@go fmt ./...
|
||||
|
||||
.PHONY: check
|
||||
check: .check-fmt .check-vet .check-lint .check-ineffassign .check-mega .check-misspell
|
||||
check: ## Perform static code analysis
|
||||
check: .check-misspell .check-lint
|
||||
|
||||
.PHONY: .check-fmt
|
||||
.check-fmt:
|
||||
@go fmt ./... | tee /dev/stderr | ifne false
|
||||
|
||||
.PHONY: .check-vet
|
||||
.check-vet:
|
||||
@go vet ./...
|
||||
.PHONY: .check-misspell
|
||||
.check-misspell:
|
||||
@$(GOBIN)/misspell ./...
|
||||
|
||||
.PHONY: .check-lint
|
||||
.check-lint:
|
||||
@golint -set_exit_status ./...
|
||||
|
||||
.PHONY: .check-ineffassign
|
||||
.check-ineffassign:
|
||||
@ineffassign .
|
||||
|
||||
.PHONY: .check-mega
|
||||
.check-mega:
|
||||
@megacheck ./...
|
||||
|
||||
.PHONY: .check-misspell
|
||||
.check-misspell:
|
||||
@misspell ./...
|
||||
@$(GOBIN)/golangci-lint run -s --disable-all -E govet -E errcheck -E staticcheck \
|
||||
-E gas -E typecheck -E unused -E structcheck -E varcheck -E ineffassign -E deadcode \
|
||||
-E gofmt -E golint -E gosimple -E unconvert -E dupl -E depguard -E gocyclo \
|
||||
--tests=false \
|
||||
--exclude-use-default=false \
|
||||
--exclude='composite literal uses unkeyed fields' \
|
||||
--exclude='Error return value of `.+\.Close` is not checked' \
|
||||
--exclude='G104' \
|
||||
--exclude='G304' \
|
||||
--exclude='G401' \
|
||||
--exclude='G501' \
|
||||
./...
|
||||
|
||||
GOTEST := go test -cover -race -tags all
|
||||
|
||||
.PHONY: test
|
||||
test: ## Run unit and integration tests
|
||||
test:
|
||||
@$(GOTEST) .
|
||||
@$(GOTEST) ./migrate
|
||||
@@ -44,19 +53,13 @@ bench:
|
||||
get-deps:
|
||||
go get -t ./...
|
||||
|
||||
ifndef GOBIN
|
||||
export GOBIN := $(GOPATH)/bin
|
||||
endif
|
||||
|
||||
.PHONY: get-tools
|
||||
get-tools: GOPATH := $(shell mktemp -d)
|
||||
get-tools:
|
||||
@echo "==> Installing tools at $(GOBIN)..."
|
||||
@mkdir -p $(GOBIN)
|
||||
|
||||
@go get -u github.com/golang/lint/golint
|
||||
@go get -u github.com/client9/misspell/cmd/misspell
|
||||
@go get -u github.com/gordonklaus/ineffassign
|
||||
@go get -u honnef.co/go/tools/cmd/megacheck
|
||||
@go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
|
||||
|
||||
@rm -Rf $(GOPATH)
|
||||
|
||||
@@ -167,7 +167,7 @@ func (m *Mapper) FieldsByName(v reflect.Value, names []string) []reflect.Value {
|
||||
// to a struct. Returns empty int slice for each name not found.
|
||||
func (m *Mapper) TraversalsByName(t reflect.Type, names []string) [][]int {
|
||||
r := make([][]int, 0, len(names))
|
||||
m.TraversalsByNameFunc(t, names, func(_ int, i []int) error {
|
||||
m.TraversalsByNameFunc(t, names, func(_ int, i []int) error { // nolint
|
||||
if i == nil {
|
||||
r = append(r, []int{})
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user