Files
gocqlx/Makefile

66 lines
1.4 KiB
Makefile
Raw Normal View History

2018-05-22 16:40:31 +02:00
all: check test bench
2017-07-21 15:13:09 +02:00
2018-07-28 06:41:33 +02:00
ifndef GOBIN
export GOBIN := $(GOPATH)/bin
endif
.PHONY: fmt
fmt: ## Format source code
@go fmt ./...
2017-07-21 15:13:09 +02:00
.PHONY: check
2018-07-28 06:41:33 +02:00
check: ## Perform static code analysis
check: .check-misspell .check-lint
2017-09-21 21:33:43 +02:00
.PHONY: .check-fmt
.check-fmt:
2018-05-22 14:48:36 +02:00
@go fmt ./... | tee /dev/stderr | ifne false
2017-09-21 21:33:43 +02:00
2018-07-28 06:41:33 +02:00
.PHONY: .check-misspell
.check-misspell:
@$(GOBIN)/misspell ./...
2017-09-21 21:33:43 +02:00
.PHONY: .check-lint
.check-lint:
2018-07-28 06:41:33 +02:00
@$(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' \
./...
2018-05-22 14:47:43 +02:00
2018-05-25 11:02:52 +02:00
GOTEST := go test -cover -race -tags all
2017-07-21 15:13:09 +02:00
.PHONY: test
2018-07-28 06:41:33 +02:00
test: ## Run unit and integration tests
2017-07-21 15:13:09 +02:00
test:
2018-05-25 11:02:52 +02:00
@$(GOTEST) .
@$(GOTEST) ./migrate
@$(GOTEST) ./qb
@$(GOTEST) ./reflectx
2018-05-22 16:40:31 +02:00
.PHONY: bench
bench:
@go test -tags all -run=XXX -bench=. -benchmem ./...
2017-07-21 15:13:09 +02:00
.PHONY: get-deps
get-deps:
go get -t ./...
2018-05-22 14:47:43 +02:00
.PHONY: get-tools
get-tools: GOPATH := $(shell mktemp -d)
get-tools:
@echo "==> Installing tools at $(GOBIN)..."
@mkdir -p $(GOBIN)
@go get -u github.com/client9/misspell/cmd/misspell
2018-07-28 06:41:33 +02:00
@go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
2018-05-22 14:47:43 +02:00
@rm -Rf $(GOPATH)