SRC := $(shell find . -name "*.go" | grep -v -e .pb.go -e .pb.micro.go)

.DEFAULT_GOAL := help

ifneq (,$(wildcard ./.env))
    include .env
    export
endif

fmt: ## Format and fix import order
	goimports -w -local "golang-app" $(SRC)

help: ## Display this help screen
	@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

build:
	go build -ldflags "-s -w" -o bin/app .

run:
	make build-backoffice-gateway
	./bin/app
