1
1
# ###############################################################################
2
2
3
- # This Makefile generated by GoMakeGen 2.2.0 using next command:
3
+ # This Makefile generated by GoMakeGen 3.0.2 using next command:
4
4
# gomakegen --mod .
5
5
#
6
6
# More info: https://kaos.sh/gomakegen
7
7
8
8
# ###############################################################################
9
9
10
- export GO111MODULE =on
11
-
12
10
ifdef VERBOSE # # Print verbose information (Flag)
13
11
VERBOSE_FLAG = -v
14
12
endif
15
13
14
+ COMPAT ?= 1.19
16
15
MAKEDIR = $(dir $(realpath $(firstword $(MAKEFILE_LIST ) ) ) )
17
16
GITREV ?= $(shell test -s $(MAKEDIR ) /.git && git rev-parse --short HEAD)
18
17
19
18
# ###############################################################################
20
19
21
20
.DEFAULT_GOAL := help
22
- .PHONY = fmt vet all clean deps update init vendor mod-init mod-update mod-download mod-vendor help
21
+ .PHONY = fmt vet all install uninstall clean deps update init vendor mod-init mod-update mod-download mod-vendor help
23
22
24
23
# ###############################################################################
25
24
26
25
all : redis-latency-monitor # # Build all binaries
27
26
28
27
redis-latency-monitor :
29
- go build $(VERBOSE_FLAG ) -ldflags=" -X main.gitrev=$( GITREV) " redis-latency-monitor.go
28
+ @echo " [36;1mBuilding redis-latency-monitor…[0m"
29
+ @go build $(VERBOSE_FLAG ) -ldflags=" -X main.gitrev=$( GITREV) " redis-latency-monitor.go
30
30
31
31
install : # # Install all binaries
32
- cp redis-latency-monitor /usr/bin/redis-latency-monitor
32
+ @echo " [36;1mInstalling binaries…[0m"
33
+ @cp redis-latency-monitor /usr/bin/redis-latency-monitor
33
34
34
35
uninstall : # # Uninstall all binaries
35
- rm -f /usr/bin/redis-latency-monitor
36
+ @echo " [36;1mRemoving installed binaries…[0m"
37
+ @rm -f /usr/bin/redis-latency-monitor
36
38
37
39
init : mod-init # # Initialize new module
38
40
@@ -43,57 +45,70 @@ update: mod-update ## Update dependencies to the latest versions
43
45
vendor : mod-vendor # # Make vendored copy of dependencies
44
46
45
47
mod-init :
48
+ @echo " [37m[1/2][0m [36;1mModules initialization…[0m"
46
49
ifdef MODULE_PATH # # Module path for initialization (String)
47
- go mod init $(MODULE_PATH)
50
+ @ go mod init $(MODULE_PATH)
48
51
else
49
- go mod init
52
+ @ go mod init
50
53
endif
51
54
55
+ @echo "[37m[2/2][0m [36;1mDependencies cleanup…[0m"
52
56
ifdef COMPAT # # Compatible Go version (String)
53
- go mod tidy $(VERBOSE_FLAG) -compat=$(COMPAT)
57
+ @ go mod tidy $(VERBOSE_FLAG) -compat=$(COMPAT) -go =$(COMPAT)
54
58
else
55
- go mod tidy $(VERBOSE_FLAG)
59
+ @ go mod tidy $(VERBOSE_FLAG)
56
60
endif
57
61
58
62
mod-update :
63
+ @echo " [37m[1/4][0m [36;1mUpdating dependencies…[0m"
59
64
ifdef UPDATE_ALL # # Update all dependencies (Flag)
60
- go get -u $(VERBOSE_FLAG) all
65
+ @ go get -u $(VERBOSE_FLAG) all
61
66
else
62
- go get -u $(VERBOSE_FLAG) ./...
67
+ @ go get -u $(VERBOSE_FLAG) ./...
63
68
endif
64
69
70
+ @echo "[37m[2/4][0m [36;1mStripping toolchain info…[0m"
71
+ @grep -q 'toolchain ' go.mod && go mod edit -toolchain=none || :
72
+
73
+ @echo "[37m[3/4][0m [36;1mDependencies cleanup…[0m"
65
74
ifdef COMPAT
66
- go mod tidy $(VERBOSE_FLAG) -compat=$(COMPAT)
75
+ @ go mod tidy $(VERBOSE_FLAG) -compat=$(COMPAT)
67
76
else
68
- go mod tidy $(VERBOSE_FLAG)
77
+ @ go mod tidy $(VERBOSE_FLAG)
69
78
endif
70
79
71
- test -d vendor && rm -rf vendor && go mod vendor $(VERBOSE_FLAG) || :
80
+ @echo "[37m[4/4][0m [36;1mUpdating vendored dependencies…[0m"
81
+ @test -d vendor && rm -rf vendor && go mod vendor $(VERBOSE_FLAG) || :
72
82
73
83
mod-download :
74
- go mod download
84
+ @echo " [36;1mDownloading dependencies…[0m"
85
+ @go mod download
75
86
76
87
mod-vendor :
77
- rm -rf vendor && go mod vendor $(VERBOSE_FLAG )
88
+ @echo " [36;1mVendoring dependencies…[0m"
89
+ @rm -rf vendor && go mod vendor $(VERBOSE_FLAG ) || :
78
90
79
91
fmt : # # Format source code with gofmt
80
- find . -name " *.go" -exec gofmt -s -w {} \;
92
+ @echo " [36;1mFormatting sources…[0m"
93
+ @find . -name " *.go" -exec gofmt -s -w {} \;
81
94
82
95
vet : # # Runs 'go vet' over sources
83
- go vet -composites=false -printfuncs=LPrintf,TLPrintf,TPrintf,log.Debug,log.Info,log.Warn,log.Error,log.Critical,log.Print ./...
96
+ @echo " [36;1mRunning 'go vet' over sources…[0m"
97
+ @go vet -composites=false -printfuncs=LPrintf,TLPrintf,TPrintf,log.Debug,log.Info,log.Warn,log.Error,log.Critical,log.Print ./...
84
98
85
99
clean : # # Remove generated files
86
- rm -f redis-latency-monitor
100
+ @echo " [36;1mRemoving built binaries…[0m"
101
+ @rm -f redis-latency-monitor
87
102
88
103
help : # # Show this info
89
104
@echo -e ' \n\033[1mTargets:\033[0m\n'
90
105
@grep -E ' ^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST ) \
91
- | awk ' BEGIN {FS = ":.*?## "}; {printf " \033[33m%-23s \033[0m %s\n", $$1, $$2}'
106
+ | awk ' BEGIN {FS = ":.*?## "}; {printf " \033[33m%-9s \033[0m %s\n", $$1, $$2}'
92
107
@echo -e ' \n\033[1mVariables:\033[0m\n'
93
108
@grep -E ' ^ifdef [A-Z_]+ .*?## .*$$' $(abspath $(lastword $(MAKEFILE_LIST ) ) ) \
94
109
| sed ' s/ifdef //' \
95
- | awk ' BEGIN {FS = " .*?## "}; {printf " \033[32m%-14s \033[0m %s\n", $$1, $$2}'
110
+ | awk ' BEGIN {FS = " .*?## "}; {printf " \033[32m%-11s \033[0m %s\n", $$1, $$2}'
96
111
@echo -e ' '
97
- @echo -e ' \033[90mGenerated by GoMakeGen 2.2.0 \033[0m\n'
112
+ @echo -e ' \033[90mGenerated by GoMakeGen 3.0.2 \033[0m\n'
98
113
99
114
# ###############################################################################
0 commit comments