Skip to content

Instantly share code, notes, and snippets.

@jgworks
Created February 17, 2017 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jgworks/58de0d88f00c9b0ec39045c8fcf0dead to your computer and use it in GitHub Desktop.
Save jgworks/58de0d88f00c9b0ec39045c8fcf0dead to your computer and use it in GitHub Desktop.
Make file for go projects
## simple makefile to log workflow
.PHONY: all test clean build install
GO=go
GOFLAGS ?= $(GOFLAGS:)
GOARCH ?= amd64 #$(GOARCH:amd64)
all: fmt vet build
build:
$(GO) build $(GOFLAGS) ./...
fmt:
$(GO) fmt $(GOFLAGS) ./...
imports:
$(GO)imports -l -w .
vet:
$(GO) vet $(GOFLAGS) ./...
install:
$(GO) get $(GOFLAGS) ./...
upgrade:
$(GO) get -u $(GOFLAGS) ./...
test: install
$(GO) test $(GOFLAGS) ./...
bench: install
$(GO) test -run=NONE -bench=. $(GOFLAGS) ./...
linux:
GOOS=linux GOARCH=$(GOARCH) make build
windows:
GOOS=windows GOARCH=$(GOARCH) make build
clean:
$(GO) clean $(GOFLAGS) -i ./...
## EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment