forked from skycoin/skycoin-explorer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
49 lines (34 loc) · 1.38 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
EXPLORER := explorer
.DEFAULT_GOAL := help
.PHONY: run build-go build-ng all setcap deploy help lint check install-linters format verify
run: ## Run explorer.go
go run explorer.go
run-api: ## Run explorer.go -api-only
go run explorer.go -api-only
build-go: ## Build explorer.go
go build -o $(EXPLORER) explorer.go
build-ng: ## Build the angular frontend
npm run build
all: build-go build-ng ## Build explorer.go and the angular frontend
setcap: ## Use setcap to allow the binary to bind to port 80
sudo setcap 'cap_net_bind_service=+ep' $(EXPLORER)
test: ## Run tests
go test . -timeout=1m
verify: ## Run explorer self-verification
go build -o explorer.verify explorer.go
@./explorer.verify -verify; \
status=$$?; \
rm -f explorer.verify; \
exit $$status
lint: ## Run linters. Use make install-linters first.
vendorcheck ./...
gometalinter --disable-all -E goimports --tests --vendor ./...
check: lint test verify ## Run tests, linters and self-verification
install-linters: ## Install linters
go get -u github.com/FiloSottile/vendorcheck
go get -u github.com/alecthomas/gometalinter
gometalinter --vendored-linters --install
format: ## Formats the code. Must have goimports installed (use make install-linters).
goimports -w explorer.go
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'