-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
47 lines (38 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
45
46
47
include .env
d := $(shell date)
branch := $(shell git branch | grep \* | cut -d ' ' -f2)
packages=brick orm examples net
.PHONY: help
all: help
help: Makefile
@echo
@echo " Choose a command run in ${BINARY}:"
@echo
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'
@echo
## check: gofmt & golint code
check:
@for v in `echo $(packages)`; do \
gofmt -l -w -s $$v; \
golint $$v/...; \
done
## pull: Revert & pull code from remote by current branch.
pull:
git reset --hard
git pull origin ${branch}
## push: Auto commit & push code to remote by current branch.
push: version
git commit -am "chore: date is $d."
git push origin ${branch}
## cover: Run all test code & print cover profile.
cover:
go test -coverprofile=/tmp/${BINARY}-makecover.out ${TEST_PACKAGES} && go tool cover -html=/tmp/${BINARY}-makecover.out
## version: Show current code version.
version:
@git remote -v
@echo branch: $(branch)
## chglog: Run git-chglog & save to CHANGELOG
chglog:
@git-chglog -o CHANGELOG.md
git commit -am "add chglog: date is $d."
git push origin ${branch}