Created
September 29, 2016 14:54
-
-
Save disktnk/eb892f6f0d5f7a61ca34c0cf93cd3954 to your computer and use it in GitHub Desktop.
ref: みんなのGO言語
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# meta info | |
NAME := myproj | |
VERSION := $(shell git describe --tags --abbrev=0) | |
REVISION := $(shell git rev-parse --short HEAD) | |
LDFLAGS := -X 'main.version=$(VERSION)' \ | |
-X 'main.revision=$(REVISION)' | |
# setup required tools | |
## Setup | |
setup: | |
go get github.com/Masterminds/glide | |
go get github.com/golang/lint/golint | |
go get golang.org/x/tools/cmd/goimports | |
go get github.com/Songmu/make2help/cmd/make2help | |
# execute test | |
## Run tests | |
test: deps | |
go test $$(glide novendor) | |
# install depended packages, use glide | |
## Install dependencies | |
deps: setup | |
glide install | |
## Update dependencies | |
update: setup | |
glide update | |
## Lint | |
lint: setup | |
go vet $$(glide novendor) | |
for pkg in $$(glide novendor -x); do\ | |
golint -set_exit_status $$pkg || exit $$?; \ | |
done | |
## Format source codes | |
fmt: setup | |
goimports -w $$(glide nv -x) | |
## buld binaries ex. make bin/myproj | |
bin/%: cmd/%/main.go deps | |
go build -ldflags "$(LDFLAGS)" -o $@ $< | |
## Show help | |
help: | |
@make2help $(MAKEFILE_LIST) | |
.PHONY: setup deps update test lint help |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment