Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: contribution guide & makefile (#102)
- Loading branch information
Showing
3 changed files
with
36 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,3 +30,4 @@ repos: | |
hooks: | ||
- id: go-mod-tidy | ||
- id: go-fmt | ||
- id: go-imports |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
SOURCE_FILES?=./... | ||
TEST_PATTERN?=. | ||
TEST_OPTIONS?= | ||
|
||
.PHONY: help $(MAKECMDGOALS) | ||
.DEFAULT_GOAL := help | ||
|
||
export GO111MODULE := on | ||
export GOPROXY = https://proxy.golang.org,direct | ||
|
||
help: ## List targets & descriptions | ||
@cat Makefile* | grep -E '^[a-zA-Z_-]+:.*?## .*$$' | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
||
setup: ## Install dependencies | ||
go mod download | ||
go mod tidy | ||
|
||
test: ## Run tests | ||
LC_ALL=C go test $(TEST_OPTIONS) -failfast -race -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt $(SOURCE_FILES) -run $(TEST_PATTERN) -timeout=5m | ||
|
||
cover: test ## Run tests and open coverage report | ||
go tool cover -html=coverage.txt | ||
|
||
fmt: ## gofmt and goimports all go files | ||
gofmt -l -w . | ||
goimports -l -w . | ||
|
||
lint: ## Run linters | ||
golangci-lint run |