.PHONY: help
help: ## Display available commands.
	@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)

.PHONY: lint
lint: ## Run all code formatters, linters and analysers. Must always be run before GIT commit or push commands!
	# Format source code.
	goimports -w .
	# Report source code irregularities.
	go vet ./...
	# Report cyclomatic complexity of functions over N.
	gocyclo -over 10 .
	# Report source code errors, bugs and smells.
	golangci-lint run --config .golangci.yaml
	# Prune unused packages and dependencies from the go.mod file.
	go mod tidy -v
	# Remove artefact files left behind by other operations.
	go clean ./...

.PHONY: test
test: ## Run whole test suite.
	gotest -v -race -timeout=180s -count=1 -cover ./...
