-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
53 lines (40 loc) · 1.76 KB
/
Makefile
File metadata and controls
53 lines (40 loc) · 1.76 KB
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
50
51
52
.DEFAULT_GOAL:=help
SHELL:=/bin/sh
GOPATH := $(shell go env GOPATH)
help:
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\033[36m\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
########################################################################################################################
##@ Common
########################################################################################################################
.PHONY: build
build: ## Builds the application for production
go build -ldflags="-w -s" -o ./bin/sample-release-app ./cmd/sample-release-app/main.go
.PHONY: docker-build
docker-build: ## Build the docker image
docker build -t sample-release-app:latest .
.PHONY: clean
clean: ## Runs mod tidy
go mod tidy
.PHONY: update
update: ## Update go modules
go get -t -u ./...
########################################################################################################################
##@ Run
########################################################################################################################
.PHONY: run
run: ## Execute the application locally
go run -race ./cmd/sample-release-app/main.go
.PHONY: release
release: ## Build the application for multiple platforms
goreleaser release
########################################################################################################################
##@ Code Style
########################################################################################################################
.PHONY: format
format: ## Format code and organize imports
goimports -w .
go fmt ./...
fieldalignment -fix ./...
.PHONY: lint
lint: ## Runs golangci-lint
golangci-lint run