-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
31 lines (24 loc) · 858 Bytes
/
Makefile
File metadata and controls
31 lines (24 loc) · 858 Bytes
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
MODULE = $(shell go list -m)
VERSION ?= $(shell git describe --tags --always --dirty --match=v* 2> /dev/null || echo "1.0.0")
PACKAGES := $(shell go list ./... | grep -v /vendor/)
LDFLAGS := -ldflags "-X main.Version=${VERSION}"
.PHONY: default
default: help
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: run
run: ## run the Impact API server
go run ${LDFLAGS} cmd/server/main.go
.PHONY: build
build: ## build the API server binary
CGO_ENABLED=0 go build ${LDFLAGS} -a -o server $(MODULE)/cmd/server
.PHONY: version
version: ## display the version of the API server
@echo $(VERSION)
.PHONY: lint
lint: ## run golint on all Go package
@golint $(PACKAGES)
.PHONY: fmt
fmt: ## run "go fmt" on all Go packages
@go fmt $(PACKAGES)