-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
54 lines (42 loc) · 1.13 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
45
46
47
48
49
50
51
52
53
54
PROJECT_NAME := "notification_worker"
PROJECT_PATH := "github.com/hitokoto-osc/notification_worker"
PKG := "$(PROJECT_PATH)"
PKG_LIST := $(shell go list ${PKG}/... | grep -v /vendor/)
GO_FILES := $(shell find . -name '*.go' | grep -v /vendor/ | grep -v _test.go)
.PHONY: all dep get-tools lint vet test test-coverage build clean
all:
build
get-tools:
@echo Installing tools...
go get -u github.com/mgechev/revive
dep: # get dependencies
@echo Installing Dependencies...
go mod download
lint: get-tools ## Lint Golang files
@echo
@echo Linting go codes with revive...
@revive -config ./.revive.toml -formatter stylish ${PKG_LIST}
vet:
@echo Linting go codes with go vet...
go vet ./...
build: dep
@echo;
@echo Building...;
@mkdir -p dist;
go build -v -o dist/${PROJECT_NAME} .;
test:
@echo Testing...
@go test -short ${PKG_LIST}
test-coverage:
@go test -short -coverprofile cover.out -covermode=atomic ${PKG_LIST}
@cat cover.out >> coverage.txt
clean:
@rm -f coverage.txt
@rm -f cover.out
release:
@echo Releasing by GoReleaser...
@goreleaser release --rm-dist
precommit: vet lint test
go fmt ./...
go mod tidy
git add .