diff --git a/lib/go/.gitignore b/lib/go/.gitignore index 13f0dc28..d03b3508 100644 --- a/lib/go/.gitignore +++ b/lib/go/.gitignore @@ -1,3 +1,5 @@ +/vendor +/dep /protoc /protoc-gen-go /csi.a diff --git a/lib/go/Gopkg.lock b/lib/go/Gopkg.lock new file mode 100644 index 00000000..2740cc2a --- /dev/null +++ b/lib/go/Gopkg.lock @@ -0,0 +1,39 @@ +# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. + + +[[projects]] + branch = "master" + name = "github.com/golang/protobuf" + packages = ["proto","protoc-gen-go","protoc-gen-go/descriptor","protoc-gen-go/generator","protoc-gen-go/grpc","protoc-gen-go/plugin","ptypes","ptypes/any","ptypes/duration","ptypes/timestamp"] + revision = "ae59567b9aab61b50b2590679a62c3c044030b61" + +[[projects]] + branch = "master" + name = "golang.org/x/net" + packages = ["context","http2","http2/hpack","idna","internal/timeseries","lex/httplex","trace"] + revision = "8351a756f30f1297fe94bbf4b767ec589c6ea6d0" + +[[projects]] + branch = "master" + name = "golang.org/x/text" + packages = ["collate","collate/build","internal/colltab","internal/gen","internal/tag","internal/triegen","internal/ucd","language","secure/bidirule","transform","unicode/bidi","unicode/cldr","unicode/norm","unicode/rangetable"] + revision = "1cbadb444a806fd9430d14ad08967ed91da4fa0a" + +[[projects]] + branch = "master" + name = "google.golang.org/genproto" + packages = ["googleapis/rpc/status"] + revision = "1e559d0a00eef8a9a43151db4665280bd8dd5886" + +[[projects]] + name = "google.golang.org/grpc" + packages = [".","codes","connectivity","credentials","grpclb/grpc_lb_v1/messages","grpclog","internal","keepalive","metadata","naming","peer","stats","status","tap","transport"] + revision = "f92cdcd7dcdc69e81b2d7b338479a19a8723cfa3" + version = "v1.6.0" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-digest = "f18038d4a1dd1fc54b0a56880e928dea2081cacd7ab26089cec72462ee2e4c94" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/lib/go/Gopkg.toml b/lib/go/Gopkg.toml new file mode 100644 index 00000000..c4fccb69 --- /dev/null +++ b/lib/go/Gopkg.toml @@ -0,0 +1,29 @@ +# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md +# for detailed Gopkg.toml documentation. +# +# Refer to https://github.com/toml-lang/toml for detailed TOML docs. + +# The following packages are required because they're either build +# tools or are dependencies only if the "csi" package is already +# generated. However, if the "csi" package is removed (a valid +# condition), a "dep ensure" will not fetch the dependencies it +# no longer sees in the project's dependency graph. Including the +# dependencies in the "required" list ensures they're always +# downloaded. +required = [ + "github.com/golang/protobuf/protoc-gen-go", + "golang.org/x/net/context", + "google.golang.org/grpc" +] + +[[constraint]] + branch = "master" + name = "github.com/golang/protobuf" + +[[constraint]] + branch = "master" + name = "golang.org/x/net" + +[[constraint]] + name = "google.golang.org/grpc" + version = "1.6.0" diff --git a/lib/go/Makefile b/lib/go/Makefile index 552175ff..cc1d7fe4 100644 --- a/lib/go/Makefile +++ b/lib/go/Makefile @@ -15,15 +15,33 @@ endif export GOPATH +################################################################################ +## DEP ## +################################################################################ + +DEP ?= ./dep +DEP_VER ?= 0.3.1 +DEP_BIN := dep-$$GOHOSTOS-$$GOHOSTARCH +DEP_URL := https://github.com/golang/dep/releases/download/v$(DEP_VER)/$$DEP_BIN + +$(DEP): + GOVERSION=$$(go version | awk '{print $$4}') && \ + GOHOSTOS=$$(echo $$GOVERSION | awk -F/ '{print $$1}') && \ + GOHOSTARCH=$$(echo $$GOVERSION | awk -F/ '{print $$2}') && \ + DEP_BIN="$(DEP_BIN)" && \ + DEP_URL="$(DEP_URL)" && \ + curl -sSLO $$DEP_URL && \ + chmod 0755 "$$DEP_BIN" && \ + mv -f "$$DEP_BIN" "$@" + +vendor: | $(DEP) + $(DEP) ensure -v -vendor-only + + ######################################################################## ## PROTOC ## ######################################################################## - -# Only set PROTOC_VER if it has an empty value. -ifeq (,$(strip $(PROTOC_VER))) -PROTOC_VER := 3.5.1 -endif - +PROTOC_VER ?= 3.5.1 PROTOC_OS := $(shell uname -s) ifeq (Darwin,$(PROTOC_OS)) PROTOC_OS := osx @@ -57,10 +75,9 @@ $(PROTOC): # This is the recipe for getting and installing the go plug-in # for protoc PROTOC_GEN_GO_PKG := github.com/golang/protobuf/protoc-gen-go -PROTOC_GEN_GO := protoc-gen-go -$(PROTOC_GEN_GO): - go get -d $(PROTOC_GEN_GO_PKG) && \ - go build -o "$@" $(PROTOC_GEN_GO_PKG) +PROTOC_GEN_GO := ./protoc-gen-go +$(PROTOC_GEN_GO): | vendor + go build -o "$@" ./vendor/$(PROTOC_GEN_GO_PKG) ########################################################################