-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
44 lines (34 loc) · 1.06 KB
/
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
44
NO_COLOR=\033[0m
OK_COLOR=\033[32;01m
BINARY = gotest-ls
BINDIR = bin
export GO111MODULE=on
GO ?= go
GOFLAGS ?= -v
GOLANGCI_LINT ?= golangci-lint-$(GOLANGCI_LINT_VERSION)
.PHONY: all
all: deps test build
clean:
@echo "$(OK_COLOR)==> Cleaning... $(NO_COLOR)"
@rm -rf $(BINDIR)
.PHONY: deps
deps:
$(GO) mod vendor -v
.PHONE: build
build:
@echo "$(OK_COLOR)==> Building$(NO_COLOR)"
@$(GO) build $(GOFLAGS) -o $(BINDIR)/$(BINARY) main.go
## run unit tests
test:
@echo "$(OK_COLOR)==> Running tests$(NO_COLOR)"
$(GO) test -covermode=atomic -coverprofile=coverage.out -race -shuffle=on ./...
.PHONY: lint
lint: bin/$(GOLANGCI_LINT)
@echo "$(OK_COLOR)==> Running lint$(NO_COLOR)"
@gofumpt -e -d -w .
@bin/$(GOLANGCI_LINT) run -c .golangci.yml
# Download and install golangci-lint
bin/$(GOLANGCI_LINT):
@echo "$(OK_COLOR)==> Installing golangci-lint $(GOLANGCI_LINT_VERSION)$(NO_COLOR)"; \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./bin "$(GOLANGCI_LINT_VERSION)"
@mv ./bin/golangci-lint bin/$(GOLANGCI_LINT)