Skip to content

Instantly share code, notes, and snippets.

@jugyo
Last active April 11, 2018 16:23
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 jugyo/b47fe2c36262b9714d2ba1172c5ddc5f to your computer and use it in GitHub Desktop.
Save jugyo/b47fe2c36262b9714d2ba1172c5ddc5f to your computer and use it in GitHub Desktop.
Makefile for go
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
BINARY_NAME=mybinary
BINARY_LINUX=$(BINARY_NAME)_linux
all: test build
build:
GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINARY_NAME) -v
test:
$(GOTEST) -v ./...
clean:
$(GOCLEAN)
rm -f $(BINARY_NAME)
rm -f $(BINARY_LINUX)
run:
$(GOBUILD) -o $(BINARY_NAME) -v ./...
./$(BINARY_NAME)
deps:
$(GOGET) cloud.google.com/go/storage
build-linux:
GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINARY_LINUX) -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment