-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcommon.mk
More file actions
70 lines (49 loc) · 1.22 KB
/
Copy pathcommon.mk
File metadata and controls
70 lines (49 loc) · 1.22 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
TARGET=fs
BIN=./bin
SRC=.
GOCMD=go
GOBUILD=CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
GOIMPORTS=goimports -w .
GIT_COMMIT := $(shell git rev-list -1 HEAD)
BUILT_ON := $(shell hostname)
BUILD_DATE := $(shell date +%FT%T%z)
LDFLAGS := "-X main.gitCommitHash=$(GIT_COMMIT) -X main.builtAt=$(BUILD_DATE) -X main.builtBy=$(USER) -X main.builtOn=$(BUILT_ON)"
DOCKER_IMAGE=krypton-fs
HAS_GO_LINT:=$(shell command -v golint 2> /dev/null)
HAS_GO_IMPORTS:=$(shell command -v goimports 2>/dev/null)
GHCR=ghcr.io/hpinc
REPO=krypton
clean:
$(GOCLEAN)
-make -C tools/compose clean
-docker rmi -f $(DOCKER_IMAGE) 2>/dev/null 1>&2
-rm -rf $(BIN) vendor
tidy:
go mod tidy
fmt:
go fmt ./...
vet:
go vet ./...
vendor:
go mod vendor
gosec:
gosec ./...
run-test:
(make -C test test)
unit-test:
go test ./...
imports: check_goimports
$(GOIMPORTS)
tag:
docker tag $(DOCKER_IMAGE) $(GHCR)/$(REPO)/$(DOCKER_IMAGE)
push: tag
docker push $(GHCR)/$(REPO)/$(DOCKER_IMAGE)
lint:
./tools/run_linter.sh
check_golint:
@which golint >/dev/null 2>&1 || (echo "golint not found";exit 1)
check_goimports:
@which goimports >/dev/null 2>&1 || (echo "goimports not found";exit 1)