-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
49 lines (34 loc) · 748 Bytes
/
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
.PHONY: all clean build build-clean
.PHONY: fmt lint fieldalign fieldalign-fix
OUT_DIR = ./bin
CMD_DIR = ./cmd/stuffnotifier
OUTFILE = $(OUT_DIR)/main
GO = $(shell which go)
TEST_FLAGS := -count 1
define go_test
$(GO) test $(MODULE_DIRS) $(strip $(TEST_FLAGS) $1)
endef
define _buildcmd
@rm -rf $1
@mkdir -p ./bin
$(GO) build -o $1 $2
endef
define _fieldalign
fieldalignment $(strip $1) $2
endef
all : clean build
build :
$(call _buildcmd,$(OUTFILE),$(CMD_DIR))
build-clean : clean build
test-ci :
$(call go_test, -coverprofile=profile.cov)
lint :
@golangci-lint run --config=.golangci.yml
fieldalign :
$(call _fieldalign,,$(FILES))
fieldalign-fix :
$(call _fieldalign,-fix,$(FILES))
fmt :
gofmt -s -w ./
clean :
@rm -rf ./bin