# ==================================================================================== # # HELPERS # ==================================================================================== # ## help: print this help message .PHONY: help help: @echo 'Usage:' @sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /' .PHONY: confirm confirm: @echo -n 'Are you sure? [y/N] ' && read ans && [ $${ans:-N} = y ] # ==================================================================================== # # DEVELOPMENT # ==================================================================================== # ## run/api: run the cmd/api application .PHONY: run/api run/api: go run ./cmd/api -port=4002 # ==================================================================================== # # QUALITY CONTROL # ==================================================================================== # ## audit: tidy dependencies and format, vet and test all code .PHONY: audit audit: vendor @echo 'Tidying and verifying module dependencies...' go mod tidy go mod verify @echo 'Formatting code...' go fmt ./... @echo 'Vetting code...' go vet ./... @echo 'Running tests...' go test -race -vet=off ./... ## vendor: tidy and vendor dependencies .PHONY: vendor vendor: @echo 'Tidying and verifying module dependencies...' go mod tidy go mod verify @echo 'Vendoring dependencies...' go mod vendor # ==================================================================================== # # BUILD # ==================================================================================== # ## build/api: build the cmd/api application .PHONY: build/api build/api: go build -ldflags='-s' -o ./bin/api ./cmd/api GOOS=linux GOARCH=amd64 go build -ldflags='-s' -o ./bin/linux_amd64/api ./cmd/api