From 301c0892f33d1e69365cc8ae395395220cb7072c Mon Sep 17 00:00:00 2001 From: Ying Li Date: Sun, 1 Nov 2015 01:36:38 -0700 Subject: [PATCH] Update README to reflect go 1.5.1 requirement and add an endpoint to the makefile to check the go version Signed-off-by: Ying Li --- Makefile | 22 ++++++++++++++++------ README.md | 4 ++-- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 942b9ba410..6516d5d4a4 100644 --- a/Makefile +++ b/Makefile @@ -24,10 +24,20 @@ COVERPROFILE=$(COVERDIR)/cover.out COVERMODE=count PKGS = $(shell go list ./... | tr '\n' ' ') +GO_VERSION = $(shell go version | awk '{print $$3}') + .PHONY: clean all fmt vet lint build test binaries cross cover docker-images .DELETE_ON_ERROR: cover .DEFAULT: default +go_version: +ifneq ("$(GO_VERSION)", "go1.5.1") + $(error Requires go version 1.5.1 - found $(GO_VERSION)) +else + @echo +endif + + all: AUTHORS clean fmt vet fmt lint build test binaries AUTHORS: .git/HEAD @@ -49,7 +59,7 @@ ${PREFIX}/bin/notary-signer: NOTARY_VERSION $(shell find . -type f -name '*.go') @echo "+ $@" @godep go build -o $@ ${GO_LDFLAGS} ./cmd/notary-signer -vet: +vet: go_version @echo "+ $@" @test -z "$$(go tool vet -printf=false . 2>&1 | grep -v Godeps/_workspace/src/ | tee /dev/stderr)" @@ -61,12 +71,12 @@ lint: @echo "+ $@" @test -z "$$(golint ./... | grep -v .pb. | grep -v Godeps/_workspace/src/ | tee /dev/stderr)" -build: +build: go_version @echo "+ $@" @go build -v ${GO_LDFLAGS} ./... test: OPTS = -test: +test: go_version @echo "+ $@ $(OPTS)" go test $(OPTS) ./... @@ -88,7 +98,7 @@ define gocover $(GO_EXC) test $(OPTS) -covermode="$(COVERMODE)" -coverprofile="$(COVERDIR)/$(subst /,-,$(1)).cover" "$(1)" || exit 1; endef -gen-cover: +gen-cover: go_version @rm -rf "$(COVERDIR)" @mkdir -p "$(COVERDIR)" $(foreach PKG,$(PKGS),$(call gocover,$(PKG))) @@ -110,7 +120,7 @@ ci: gen-cover clean-protos: @rm proto/*.pb.go -binaries: ${PREFIX}/bin/notary-server ${PREFIX}/bin/notary ${PREFIX}/bin/notary-signer +binaries: go_version ${PREFIX}/bin/notary-server ${PREFIX}/bin/notary ${PREFIX}/bin/notary-signer @echo "+ $@" define template @@ -118,7 +128,7 @@ mkdir -p ${PREFIX}/cross/$(1)/$(2); GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 go build -o ${PREFIX}/cross/$(1)/$(2)/notary -a -tags "static_build netgo" -installsuffix netgo ${GO_LDFLAGS_STATIC} ./cmd/notary; endef -cross: +cross: go_version $(foreach GOARCH,$(GOARCHS),$(foreach GOOS,$(GOOSES),$(call template,$(GOOS),$(GOARCH)))) diff --git a/README.md b/README.md index 67790435ad..1516ef6291 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ Lets try using notary. Prerequisites: -- Requirements from the [Compiling Notary Server](#compiling-notary-server) section +- Requirements from the [Compiling Notary Server](#compiling-notary-server) section (such as go 1.5.1) - [docker and docker-compose](http://docs.docker.com/compose/install/) - [Notary server configuration](#configuring-notary-server) @@ -125,7 +125,7 @@ OpenSSL example: Prerequisites: -- Go >= 1.3 +- Go = 1.5.1 - [godep](https://github.com/tools/godep) installed - libtool development headers installed