Skip to content

Instantly share code, notes, and snippets.

@iolalla
Created May 8, 2022 16:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iolalla/f0aad720f0a49ea68d9e5a42eba7a0ca to your computer and use it in GitHub Desktop.
Save iolalla/f0aad720f0a49ea68d9e5a42eba7a0ca to your computer and use it in GitHub Desktop.
Golang Makefile
help: ## show help message
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[$$()% a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
build: ## "Building a valid production binary"
echo "Building a valid production binary"
go build -o play
bu: ## "Looks like we have a binary ready to debug"
echo "Looks like we have a binary ready to debug"
go build -gcflags="all=-N -l" -o play
package: ## "Compiling for production and prepare docker"
echo "Compiling for production and prepare docker"
go build -o play
docker build -t play .
ds: ## "Run DataStore Server"
echo "Run DataStore Server"
gcloud beta emulators datastore start --data-dir /home/iolalla/src/gostocks/play/datastore --consistency 1
send: ## "Send the build image to the registry"
echo "Send the build image to the registry"
gcloud builds submit --tag gcr.io/game-bolsa/play
test: ## "Run tests"
echo "Run tests"
go clean -testcache
go test -v ./...
all: package send ## "Executes package and send"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment