forked from alexyslozada/ecommerce
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
40 lines (33 loc) · 1.01 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
# COLORS
ccgreen=$(shell echo "\033[32m")
ccred=$(shell echo "\033[0;31m")
ccyellow=$(shell echo "\033[0;33m")
ccend=$(shell echo "\033[0m")
# SILENT MODE (avoid echoes)
.SILENT: all fmt test linter build
# PROCESS
all: fmt test linter build
fmt:
echo "$(ccyellow)Formatting files...$(ccend)"
$(GOPATH)/bin/goimports -w -local alexyslozada .
echo "$(ccgreen)Formatting files done!$(ccend)"
test:
for d in $$(go list ./...); do \
if go test -v -failfast $$d; then \
echo "$(ccyellow)$$d test pass!!!$(ccend)"; \
else \
echo "$(ccred)$$d test failed :($(ccend)"; \
exit 1; \
fi; \
done;
echo "$(ccgreen)All test pass!$(ccend)"
install-linter:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin v1.50.1
linter:
echo "$(ccyellow)Executing linter...$(ccend)"
golangci-lint run
echo "$(ccyellow)Linter finished!$(ccend)"
build:
echo "$(ccyellow)Building app...$(ccend)"
go build -o ecommerce ./cmd/*.go
echo "$(ccgreen)Finish build!$(ccend)"