forked from cosmos/crypto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
43 lines (36 loc) · 954 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Variables
PKG := ./...
GOFILES := $(shell find . -name '*.go' | grep -v _test.go)
TESTFILES := $(shell find . -name '*_test.go')
GOLANGCI_VERSION := v1.59.0
all: build
build:
@if [ -z "$(TAGS)" ]; then \
echo "Building..."; \
else \
echo "Building with tags: $(TAGS)"; \
fi
@go build -tags "$(TAGS)" $(PKG)
# Run tests
test:
@if [ -z "$(TAGS)" ]; then \
echo "Running tests..."; \
else \
echo "Running tests with tags: $(TAGS)"; \
fi
@go test -tags "$(TAGS)" -v $(PKG)
# Install golangci-lint
lint-install:
@echo "--> Installing golangci-lint $(GOLANGCI_VERSION)"
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_VERSION)
# Run golangci-lint
lint:
@echo "--> Running linter"
$(MAKE) lint-install
@golangci-lint run --timeout=15m
# Run golangci-lint and fix
lint-fix:
@echo "--> Running linter with fix"
$(MAKE) lint-install
@golangci-lint run --fix
.PHONY: build test lint-install lint lint-fix