Autocompile Go

First, install CompileDaemon: $ go get github.com/githubnemo/CompileDaemon && go install github.com/githubnemo/CompileDaemon Then, from the root of the project, create a Make file: $ touch Makefile And add the below content: GOCMD ?= go GOBUILD = $(GOCMD) build GOCLEAN = $(GOCMD) clean GOTEST = $(GOCMD) test GOGET = $(GOCMD) get BINARY_NAME = project_name BINARY_UNIX = $(BINARY_NAME)_unix default: all all: test build build: $(GOBUILD) -o ../$(BINARY_NAME) -v -ldflags="-X main.VERSION=$(TAG)" test: $(GOTEST) -v ....

August 21, 2021 · 1 min · Aleem Isiaka