-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Makefile, .gitignore, deps and --version
- Loading branch information
1 parent
74d83d5
commit 67b1962
Showing
5 changed files
with
98 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
random_data_load* | ||
vendor/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
GO := go | ||
pkgs = $(shell basename `git rev-parse --show-toplevel`) | ||
VERSION=$(shell git describe --abbrev=0) | ||
BUILD=$(shell date +%FT%T%z) | ||
GOVERSION=$(shell go version | cut --delimiter=" " -f3) | ||
COMMIT=$(shell git rev-parse HEAD) | ||
BRANCH=$(shell git rev-parse --abbrev-ref HEAD) | ||
|
||
PREFIX=$(shell pwd) | ||
TOP_DIR=$(shell git rev-parse --show-toplevel) | ||
BIN_DIR=$(shell git rev-parse --show-toplevel)/bin | ||
SRC_DIR=$(shell git rev-parse --show-toplevel)/src/go | ||
LDFLAGS="-X main.Version=${VERSION} -X main.Build=${BUILD} -X main.Commit=${COMMIT} -X main.Branch=${BRANCH} -X main.GoVersion=${GOVERSION} -s -w" | ||
|
||
.PHONY: all style format build test vet tarball linux-amd64 | ||
|
||
all: clean linux-amd64 darwin-amd64 | ||
|
||
clean: | ||
@echo "Cleaning binaries dir ${BIN_DIR}" | ||
@rm -rf ${BIN_DIR}/ 2> /dev/null | ||
|
||
linux-amd64: | ||
@echo "Building linux/amd64 binaries in ${BIN_DIR}" | ||
@mkdir -p ${BIN_DIR} | ||
@$(foreach pkg,$(pkgs),GOOS=linux GOARCH=amd64 go build -ldflags ${LDFLAGS} -o ${BIN_DIR}/$(pkg)_linux_amd64 ./;) | ||
|
||
linux-386: | ||
@echo "Building linux/386 binaries in ${BIN_DIR}" | ||
@mkdir -p ${BIN_DIR} | ||
@$(foreach pkg,$(pkgs),GOOS=linux GOARCH=386 go build -ldflags ${LDFLAGS} -o ${BIN_DIR}/$(pkg)_linux_386 ./;) | ||
|
||
darwin-amd64: | ||
@echo "Building darwin/amd64 binaries in ${BIN_DIR}" | ||
@mkdir -p ${BIN_DIR} | ||
@$(foreach pkg,$(pkgs),GOOS=darwin GOARCH=amd64 go build -ldflags ${LDFLAGS} -o ${BIN_DIR}/$(pkg)_darwin_amd64 ./;) | ||
|
||
style: | ||
@echo ">> checking code style" | ||
@! gofmt -d $(shell find . -path ./vendor -prune -o -name '*.go' -print) | grep '^' | ||
|
||
test: | ||
@echo ">> running tests" | ||
@./runtests.sh | ||
|
||
format: | ||
@echo ">> formatting code" | ||
@$(GO) fmt $(pkgs) | ||
|
||
vet: | ||
@echo ">> vetting code" | ||
@$(GO) vet $(pkgs) | ||
|
This file contains 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