-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathMakefile
More file actions
41 lines (33 loc) · 938 Bytes
/
Makefile
File metadata and controls
41 lines (33 loc) · 938 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
32
33
34
35
36
37
38
39
40
41
BUILD_DIR=bin
BUILD_VERSION ?= $(shell head -1 .version)
GIT_HASH ?= $(shell git rev-parse --short=8 HEAD)
.PHONY: build
build:
@mkdir -p ${BUILD_DIR}
@CGO_ENABLED=0 go build --ldflags "-X 'main.version=$(BUILD_VERSION)-$(GIT_HASH)'" -o ${BUILD_DIR}/app .
.PHONY: clean
clean:
@rm -fr ${BUILD_DIR}
.PHONY: all
all: tidy fmt lint build
.PHONY: lint
lint:
@echo "[golangci-lint] Running golangci-lint..."
@go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.3 run --timeout=5m 2>&1
@echo "[staticcheck] Running staticcheck..."
@go run honnef.co/go/tools/cmd/staticcheck@v0.5.1
@echo "------------------------------------[Done]"
.PHONY: fmt
fmt:
@echo "[fmt] Format go project..."
@gofmt -s -w . 2>&1
@echo "------------------------------------[Done]"
.PHONY: tidy
tidy:
@go mod tidy
.PHONY: run
run: build
@${BUILD_DIR}/app
.PHONY: test
test:
go run github.com/onsi/ginkgo/v2/ginkgo -r --keep-going ./...