-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
41 lines (31 loc) · 1.56 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
.DEFAULT_GOAL = help
SHELL = bash
project = reward
GIT_AUTHOR = janosmiko
help: ## Outputs this help screen
@grep -E '(^[\/a-zA-Z0-9_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}{printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'
# If the first argument is "gen"...
ifeq (gen,$(firstword $(MAKECMDGOALS)))
# use the rest as arguments for "run"
GEN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
# ...and turn them into do-nothing targets
$(eval $(GEN_ARGS):;@:)
endif
## —— Commands —————————————————————————————————————————————————————————
build: ## Build the command to ./dist
go mod download
go generate ./...
CGO_ENABLED=0 go build -ldflags="-s -w" -o dist/reward-cloud ./cmd/cloud/main.go
package: ## Build the binaries and packages using goreleaser (without releasing it)
goreleaser --clean --snapshot --skip-publish
build-local: ## Build the binaries only using goreleaser (without releasing it)
goreleaser --clean --snapshot --skip-publish
## —— Go Commands —————————————————————————————————————————————————————————
gomod: ## Update Go Dependencies
go mod tidy
lint: ## Lint Go Code
golangci-lint run -c .golangci.yml ./...
lint-fix: ## Lint Go Code
golangci-lint run -c .golangci.yml --fix ./...
test: ## Run Go tests
go test -race -v ./...