-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
613 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,65 @@ | ||
GO_LINT=$(shell which golangci-lint 2> /dev/null || echo '') | ||
GO_LINT_URI=github.com/golangci/golangci-lint/cmd/golangci-lint@latest | ||
|
||
GO_SEC=$(shell which gosec 2> /dev/null || echo '') | ||
GO_SEC_URI=github.com/securego/gosec/v2/cmd/gosec@latest | ||
|
||
GO_VULNCHECK=$(shell which govulncheck 2> /dev/null || echo '') | ||
GO_VULNCHECK_URI=golang.org/x/vuln/cmd/govulncheck@latest | ||
|
||
.PHONY: golangci-lint | ||
golangci-lint: | ||
$(if $(GO_LINT), ,go install $(GO_LINT_URI)) | ||
@echo "##### Running golangci-lint" | ||
golangci-lint run -v | ||
|
||
.PHONY: gosec | ||
gosec: | ||
$(if $(GO_SEC), ,go install $(GO_SEC_URI)) | ||
@echo "##### Running gosec" | ||
gosec ./... | ||
|
||
.PHONY: govulncheck | ||
govulncheck: | ||
$(if $(GO_VULNCHECK), ,go install $(GO_VULNCHECK_URI)) | ||
@echo "##### Running govulncheck" | ||
govulncheck ./... | ||
|
||
.PHONY: verify | ||
verify: golangci-lint gosec govulncheck | ||
## help: 💡 Display available commands | ||
.PHONY: help | ||
help: | ||
@echo '⚡️ GoFiber/Fiber Development:' | ||
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /' | ||
|
||
## audit: 🚀 Conduct quality checks | ||
.PHONY: audit | ||
audit: | ||
go mod verify | ||
go vet ./... | ||
go run golang.org/x/vuln/cmd/govulncheck@latest ./... | ||
|
||
## benchmark: 📈 Benchmark code performance | ||
.PHONY: benchmark | ||
benchmark: | ||
go test ./... -benchmem -bench=. -run=^Benchmark_$ | ||
|
||
## coverage: ☂️ Generate coverage report | ||
.PHONY: coverage | ||
coverage: | ||
go run gotest.tools/gotestsum@latest -f testname -- ./... -race -count=1 -coverprofile=/tmp/coverage.out -covermode=atomic | ||
go tool cover -html=/tmp/coverage.out | ||
|
||
## format: 🎨 Fix code format issues | ||
.PHONY: format | ||
format: | ||
go run mvdan.cc/gofumpt@latest -w -l . | ||
|
||
## markdown: 🎨 Find markdown format issues (Requires markdownlint-cli2) | ||
.PHONY: markdown | ||
markdown: | ||
markdownlint-cli2 "**/*.md" "#vendor" | ||
|
||
## lint: 🚨 Run lint checks | ||
.PHONY: lint | ||
lint: | ||
go run github.com/golangci/golangci-lint/cmd/[email protected] run ./... | ||
|
||
## test: 🚦 Execute all tests | ||
.PHONY: test | ||
test: | ||
@echo "##### Running tests" | ||
go test -race -cover -coverprofile=coverage.coverprofile -covermode=atomic -v ./... | ||
go run gotest.tools/gotestsum@latest -f testname -- ./... -race -count=1 -shuffle=on | ||
|
||
## longtest: 🚦 Execute all tests 10x | ||
.PHONY: longtest | ||
longtest: | ||
go run gotest.tools/gotestsum@latest -f testname -- ./... -race -count=15 -shuffle=on | ||
|
||
## tidy: 📌 Clean and tidy dependencies | ||
.PHONY: tidy | ||
tidy: | ||
go mod tidy -v | ||
|
||
## betteralign: 📐 Optimize alignment of fields in structs | ||
.PHONY: betteralign | ||
betteralign: | ||
go run github.com/dkorunic/betteralign/cmd/betteralign@latest -test_files -generated_files -apply ./... | ||
|
||
## generate: ⚡️ Generate msgp && interface implementations | ||
.PHONY: generate | ||
generate: | ||
go install github.com/tinylib/msgp@latest | ||
go install github.com/vburenin/ifacemaker@975a95966976eeb2d4365a7fb236e274c54da64c | ||
go generate ./... |
Oops, something went wrong.