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