-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
66 lines (45 loc) · 1.01 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Go PATH
export PATH := /usr/local/go/bin:/usr/bin/gcc:$(PATH)
# to pass current user env var:
# sudo -E make run
# Docker registry
REPO := fduran
# binary name (can add arch)
BIN := scanblocker
# target
TARGET := scanblocker
SRC_DIRS := cmd# pkg
#ALL_PLATFORMS := linux/amd64
#OS := linux
#ARCH := amd64
# make without args runs first target
# -ldflags "-X main.GitCommit=$GIT_COMMIT" optionally
# --ldflags '-linkmode external -extldflags "-static"'
# https://docs.docker.com/develop/develop-images/build_enhancements/
EXPORT := DOCKER_BUILDKIT=1
build:
go build -o $(BIN) $(SRC_DIRS)/$(TARGET)/*.go
run: build
./$(BIN)
dep:
go mod download
clean:
go clean
test:
go test ./... -v
fmt:
go fmt ./...
vet:
go vet
lint:
gofmt -w .
golangci-lint run --enable-all
image:
docker build -t $(REPO)/$(TARGET) .
docker tag $(REPO)/$(TARGET) $(TARGET)
# see also https://goreleaser.com/
release: image
git tag -a $(VERSION) -m "Release" || true
git push origin $(VERSION)
# dir names conflict
.PHONY: build test