-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
49 lines (38 loc) · 1.13 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
GOCMD := go
GOFMT := ${GOCMD} fmt
GOMOD := ${GOCMD} mod
RELEASE_CONTAINER_NAME := "ns1_exporter"
GOLANGCILINT_CACHE := ${CURDIR}/.golangci-lint/build/cache
## help: print this help message
.PHONY: help
help: Makefile
# autogenerate help messages for comment lines with 2 `#`
@sed -n 's/^##//p' $<
## tidy: tidy modules
tidy:
${GOMOD} tidy
## fmt: apply go code style formatter
fmt:
${GOFMT} -x ./...
## lint: run linters
lint:
mkdir -p ${GOLANGCILINT_CACHE} || true
podman run --rm -v ${CURDIR}:/app -v ${GOLANGCILINT_CACHE}:/root/.cache -w /app docker.io/golangci/golangci-lint:latest golangci-lint run -v
nilaway ./...
## binary: build a binary
binary: fmt tidy lint
goreleaser build --clean --single-target --snapshot --output .
## build: alias for `binary`
build: binary
## test: run tests
test: fmt tidy lint
go test -race -v ./...
## container: build container image with binary
container: binary
podman image build -t "${RELEASE_CONTAINER_NAME}:latest" .
## image: alias for `container`
image: container
## podman: alias for `container`
podman: container
## docker: alias for `container`
docker: container