Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
Latest commit
51 lines (45 loc) · 1.09 KB
/
Copy pathMakefile
File metadata and controls
51 lines (45 loc) · 1.09 KB
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
45
46
47
48
49
50
51
# global
BINARY := $(notdir$(CURDIR))
GO_BIN_DIR := $(GOPATH)/bin
OSES := linux darwin windows
ARCHS := amd64
# unit tests
test: lint
@echo "unit testing..."
@go test$$(go list ./... | grep -v vendor | grep -v mocks) -race -coverprofile=coverage.txt -covermode=atomic
# lint
.PHONY: lint
lint: $(GO_LINTER)
@echo "vendoring..."
@go mod vendor
@go mod tidy
@echo "linting..."
@golangci-lint run ./...
# initialize
.PHONY: init
init:
@rm -f go.mod
@rm -f go.sum
@rm -rf ./vendor
@go mod init $$(pwd | awk -F'/' '{print $$NF}')
# linter
GO_LINTER := $(GO_BIN_DIR)/golangci-lint
$(GO_LINTER):
@echo "installing linter..."
go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
.PHONY: release
release: test
@rm -rf ./release
@mkdir -p release
@for ARCH in$(ARCHS);do\
forOSin$(OSES);do \
iftest"$$OS" = "windows";then \
GOOS=$$OS GOARCH=$$ARCH go build -o release/$(BINARY)-$$OS-$$ARCH.exe;\
else\
GOOS=$$OS GOARCH=$$ARCH go build -o release/$(BINARY)-$$OS-$$ARCH;\
fi;\
done;\
done
.PHONY: codecov
codecov: test
@go tool cover -html=coverage.txt