Skip to content

Instantly share code, notes, and snippets.

@danteay
Created January 24, 2022 21:01
Show Gist options
  • Save danteay/9a29dc2e7d550c56b39fd268df7454a6 to your computer and use it in GitHub Desktop.
Save danteay/9a29dc2e7d550c56b39fd268df7454a6 to your computer and use it in GitHub Desktop.
Make file for commands in go projects
help: ## Display this help screen.
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
install: ## Install all dependencies for Go and Serverless framework
@go mod download && go mod tidy
precommit_install: ## Install precommit actions
@pre-commit install && pre-commit install --hook-type commit-msg
build: clean ## Build the project binary
@sh ./build.sh
clean: ## Clean generated binaries
@rm -rf ./bin
test: ## Execute unit testing
@go test -v -race $(shell go list ./... | grep -v node_modules)
lint: ## Lint code
@golangci-lint run ./...
run: ## Execute stand alone local server
@go run ./cmd/api/main.go
fmt: ## Format all project files
@gofmt -s -w -l $(shell go list -f ./... | grep -v /vendor/)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment