@@ -8,6 +8,7 @@ TESTFOLDER := $(shell $(GO) list ./... | grep -E 'gin$$|binding$$|render$$' | gr
88TESTTAGS  ?= ""
99
1010.PHONY : test
11+ #  Run tests to verify code functionality.
1112test :
1213	echo  " mode: count"   >  coverage.out
1314	for  d  in  $( TESTFOLDER) ;  do  \
@@ -30,10 +31,12 @@ test:
3031	done 
3132
3233.PHONY : fmt
34+ #  Ensure consistent code formatting.
3335fmt :
3436	$(GOFMT )  -w $(GOFILES ) 
3537
3638.PHONY : fmt-check
39+ #  format (check only).
3740fmt-check :
3841	@diff=$$($(GOFMT )  -d $(GOFILES ) ) ;  \ 
3942	if  [ -n  " $$ diff"   ];  then  \
@@ -43,31 +46,36 @@ fmt-check:
4346	fi ; 
4447
4548.PHONY : vet
49+ #  Examine packages and report suspicious constructs if any.
4650vet :
4751	$(GO )  vet $(VETPACKAGES ) 
4852
4953.PHONY : lint
54+ #  Inspect source code for stylistic errors or potential bugs.
5055lint :
5156	@hash golint >  /dev/null 2>&1 ;  if  [ $$ ?  -ne  0 ];  then  \
5257		$(GO )  get -u golang.org/x/lint/golint;  \ 
5358	fi 
5459	for  PKG  in  $( PACKAGES) ;  do  golint -set_exit_status $$ PKG ||  exit  1;  done ; 
5560
56- .PHONY : misspell-check
57- misspell-check :
61+ .PHONY : misspell
62+ #  Correct commonly misspelled English words in source code.
63+ misspell :
5864	@hash misspell >  /dev/null 2>&1 ;  if  [ $$ ?  -ne  0 ];  then  \
5965		$(GO )  get -u github.com/client9/misspell/cmd/misspell;  \ 
6066	fi 
61- 	misspell -error  $(GOFILES ) 
67+ 	misspell -w  $(GOFILES ) 
6268
63- .PHONY : misspell
64- misspell :
69+ .PHONY : misspell-check
70+ #  misspell (check only).
71+ misspell-check :
6572	@hash misspell >  /dev/null 2>&1 ;  if  [ $$ ?  -ne  0 ];  then  \
6673		$(GO )  get -u github.com/client9/misspell/cmd/misspell;  \ 
6774	fi 
68- 	misspell -w  $(GOFILES ) 
75+ 	misspell -error  $(GOFILES ) 
6976
7077.PHONY : tools
78+ #  Install tools (golint and misspell).
7179tools :
7280	@if [ $( GO_VERSION)   -gt  15 ];  then  \ 
7381		$(GO )  install golang.org/x/lint/golint@latest;  \ 
@@ -76,3 +84,23 @@ tools:
7684		$(GO )  install golang.org/x/lint/golint;  \ 
7785		$(GO )  install github.com/client9/misspell/cmd/misspell;  \ 
7886	fi 
87+ 
88+ .PHONY : help
89+ #  Help.
90+ help :
91+ 	@echo ' ' 
92+ 	@echo ' Usage:' 
93+ 	@echo '  make [target]' 
94+ 	@echo ' ' 
95+ 	@echo ' Targets:' 
96+ 	@awk ' /^[a-zA-Z\-\0-9]+:/ { \
97+ 	helpMessage = match(lastLine, /^#  (.*)/); \
98+ 		if  (helpMessage) { \
99+ 			helpCommand = substr($$ 1, 0, index($$ 1, " :"  )-1);  \ 
100+ 			helpMessage = substr(lastLine, RSTART + 2, RLENGTH);  \ 
101+ 			printf  "  - \033[36m%-20s\033[0m %s\n"  , helpCommand, helpMessage;  \ 
102+ 		} \ 
103+ 	} \ 
104+ 	{ lastLine = $$ 0 }'  $(MAKEFILE_LIST)
105+ 
106+ .DEFAULT_GOAL  := help
0 commit comments