Skip to content

Instantly share code, notes, and snippets.

@liyu4
Created February 14, 2017 07:43
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 liyu4/153132047981bd1259827953c67d849c to your computer and use it in GitHub Desktop.
Save liyu4/153132047981bd1259827953c67d849c to your computer and use it in GitHub Desktop.
# This how we want to name the binary output
BINARY=gomake
# These are the values we want to pass for VERSION and BUILD
VERSION=1.0.0
BUILD=`date +%FT%T%z`
# Setup the -Idflags options for go build here,interpolate the variable values
LDFLAGS=-ldflags "-X main.Version=${VERSION} -X main.Build=${BUILD}"
# Builds the project
build:
go build ${LDFLAGS} -o ${BINARY}
# Installs our project: copies binaries
install:
go install ${LDFLAGS}
# Cleans our projects: deletes binaries
clean:
if [ -f ${BINARY} ] ; then rm ${BINARY} ; fi
.PHONY: clean install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment