-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
47 lines (38 loc) · 1.3 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
VERSION=$(shell git describe --tags --always)
LDFLAGS=-tags netgo -ldflags "-X main.version=$(VERSION)"
GO=$(shell which go)
PWD=$(shell pwd)
ENV=GO111MODULE=on
BINARY = demo
PKG1 = "github.com/Zensey/go-archetype-project/cmd/demo"
PKGS = $(PKG1)
report = lint_report.txt
.DEFAULT_GOAL: $(BINARY)
all: get-deps $(BINARY)
get-deps:
$(ENV) $(GO) get -u github.com/golang/lint/golint
$(ENV) $(GO) get -u github.com/kisielk/errcheck
$(ENV) $(GO) get -u honnef.co/go/tools/cmd/staticcheck
$(ENV) $(GO) get -u honnef.co/go/tools/cmd/unused
$(ENV) $(GO) get -u mvdan.cc/interfacer
test:
$(ENV) $(GO) test $(PKG1) -v -run Main
lint:
$(ENV) golint $(PKGS) &>> $(report)
$(ENV) go tool vet ../../$(PKG1)/*.go &>> $(report)
$(ENV) go tool vet ../../$(PKG2)/*.go &>> $(report)
$(ENV) errcheck -ignore 'fmt:.*,encoding/binary:.*' -ignoretests $(PKGS) &>> $(report) ||:
$(ENV) errcheck $(PKGS) &>> $(report) ||:
$(ENV) staticcheck $(PKGS) &>> $(report) ||:
$(ENV) unused $(PKGS) &>> $(report) ||:
$(ENV) interfacer $(PKGS) &>> $(report)
$(BINARY):
$(ENV) $(GO) generate ./pkg/logger
$(ENV) $(GO) build -v $(LDFLAGS) ./cmd/demo
clean:
rm $(BINARY)
strip-$(BINARY): $(BINARY)
strip -s $(BINARY)
docker-build:
docker build -t go-archetype-project .
docker run --rm --publish 8080:8080 -it go-archetype-project