@@ -5,43 +5,16 @@ REPOSITORY := mvisonneau/$(NAME)
55
66.PHONY : setup
77setup : # # Install required libraries/tools for build tasks
8- @command -v gofumpt
2>&1 > /dev/null
|| go install mvdan.cc/
[email protected] 9- @command -v gosec
2>&1 > /dev/null
|| go install github.com/securego/gosec/v2/cmd/
[email protected] 10- @command -v ineffassign
2>&1 > /dev/null
|| go install github.com/gordonklaus/
[email protected] 11- @command -v misspell
2>&1 > /dev/null
|| go install github.com/client9/misspell/cmd/
[email protected] 12- @command -v revive
2>&1 > /dev/null
|| go install github.com/mgechev/
[email protected] 8+ @command -v gofumpt
2>&1 > /dev/null
|| go install mvdan.cc/
[email protected] 9+ @command -v golangci-lint
2>&1 > /dev/null
|| go install github.com/golangci/golangci-lint/cmd/
[email protected] 1310
1411.PHONY : fmt
1512fmt : setup # # Format source code
1613 gofumpt -w $(FILES )
1714
1815.PHONY : lint
19- lint : revive vet gofumpt ineffassign misspell gosec # # Run all lint related tests against the codebase
20-
21- .PHONY : revive
22- revive : setup # # Test code syntax with revive
23- revive -config .revive.toml $(FILES )
24-
25- .PHONY : vet
26- vet : # # Test code syntax with go vet
27- go vet ./...
28-
29- .PHONY : gofumpt
30- gofumpt : setup # # Test code syntax with gofumpt
31- gofumpt -d $(FILES ) > gofumpt.out
32- @if [ -s gofumpt.out ]; then cat gofumpt.out; rm gofumpt.out; exit 1; else rm gofumpt.out; fi
33-
34- .PHONY : ineffassign
35- ineffassign : setup # # Test code syntax for ineffassign
36- ineffassign ./...
37-
38- .PHONY : misspell
39- misspell : setup # # Test code with misspell
40- misspell -error $(FILES )
41-
42- .PHONY : gosec
43- gosec : setup # # Test code for security vulnerabilities
44- gosec ./...
16+ lint : setup # # Run all lint related tests upon the codebase
17+ golangci-lint run -v --fast
4518
4619.PHONY : test
4720test : # # Run the tests against the codebase
@@ -88,14 +61,27 @@ dev-env: ## Build a local development environment using Docker
8861 -v $(shell pwd) :/go/src/github.com/mvisonneau/$(NAME ) \
8962 -w /go/src/github.com/mvisonneau/$(NAME ) \
9063 -p 8080:8080 \
91- golang:1.17 \
64+ golang:1.18 \
9265 /bin/bash -c ' make setup; make install; bash'
9366
9467.PHONY : is-git-dirty
9568is-git-dirty : # # Tests if git is in a dirty state
9669 @git status --porcelain
9770 @test $(shell git status --porcelain | grep -c .) -eq 0
9871
72+ .PHONY : man-pages
73+ man-pages : # # Generates man pages
74+ rm -rf helpers/manpages
75+ mkdir -p helpers/manpages
76+ go run ./cmd/tools/man | gzip -c -9 > helpers/manpages/$(NAME ) .1.gz
77+
78+ .PHONY : autocomplete-scripts
79+ autocomplete-scripts : # # Download CLI autocompletion scripts
80+ rm -rf helpers/autocomplete
81+ mkdir -p helpers/autocomplete
82+ curl -sL https://raw.githubusercontent.com/urfave/cli/v2.5.0/autocomplete/bash_autocomplete > helpers/autocomplete/bash
83+ curl -sL https://raw.githubusercontent.com/urfave/cli/v2.5.0/autocomplete/zsh_autocomplete > helpers/autocomplete/zsh
84+
9985.PHONY : all
10086all : lint test build coverage # # Test, builds and ship package for all supported platforms
10187
0 commit comments