neoq/Makefile

77 lines
1.5 KiB
Makefile
Raw Normal View History

2023-02-19 15:05:59 +00:00
GOLANGCI_LINT_VERSION ?= v1.51.1
all: fmt vet mod
.PHONY: mod
mod:
@go mod tidy -compat=1.20
@go mod verify
@go mod vendor
.PHONY: fmt
fmt:
@go fmt ./...
.PHONY: vet
vet:
@go vet -tags testing ./...
2023-02-19 15:05:59 +00:00
2023-02-19 15:18:04 +00:00
.PHONY: test
test: install-gotestsum
@mkdir -p tmp/output tmp/coverage
@gotestsum \
--junitfile tmp/output/gotestsum-report.xml \
-- \
-count=5 \
-race \
-cover \
2023-02-25 03:33:38 +00:00
-tags testing \
2023-02-19 15:18:04 +00:00
-coverprofile=tmp/coverage/coverage.out \
./...
.PHONY: coverage
coverage:
@go tool cover -html=tmp/coverage/coverage.out -o tmp/coverage/coverage.html
.PHONY: func-coverage
func-coverage:
@go tool cover -func=tmp/coverage/coverage.out
2023-02-19 15:06:15 +00:00
.PHONY: update-dependencies
update-dependencies:
@go get -u -v ./...
$(MAKE) mod
2023-02-19 15:18:04 +00:00
.PHONY: test-watch
test-watch:
@gotestsum \
--watch \
--junitfile tmp/output/gotestsum-report.xml \
--post-run-command "make coverage" \
-- \
-race \
-cover \
-coverprofile=tmp/coverage/coverage.out \
./...
2023-02-19 15:05:59 +00:00
.PHONY: lint
lint:
@clear
@golangci-lint run
2023-02-19 15:05:59 +00:00
.PHONY: lint-watch
2023-02-19 15:18:04 +00:00
lint-watch: install-reflex
2023-02-19 15:05:59 +00:00
@reflex -s -r '\.go$$' -R '^vendor/' -- make lint
.PHONY: install-dev-tools
2023-02-19 15:18:04 +00:00
install-dev-tools: install-gotestsum install-reflex
2023-02-19 15:05:59 +00:00
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin $(GOLANGCI_LINT_VERSION)
2023-02-19 15:18:04 +00:00
.PHONY: install-gotestsum
install-gotestsum:
@go install gotest.tools/gotestsum@latest
.PHONY: install-reflex
install-reflex:
2023-02-19 15:05:59 +00:00
@go install github.com/cespare/reflex@latest