From 00edddac9a9d711aefa0b0750abe8c235af4ea67 Mon Sep 17 00:00:00 2001
From: Dave Tucker
Date: Wed, 5 Apr 2017 14:37:03 +0100
Subject: [PATCH] Add vndr to go-compile and add vendoring docs
This makes it easier to safely udpate the vendor directory
Signed-off-by: Dave Tucker
---
Makefile | 2 +-
docs/vendoring.md | 57 +++++++++++++++++++++++++++++++++++++
tools/go-compile/Dockerfile | 1 +
3 files changed, 59 insertions(+), 1 deletion(-)
create mode 100644 docs/vendoring.md
diff --git a/Makefile b/Makefile
index 77fe05e09..c04b13c50 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@ all: default
VERSION="0.0" # dummy for now
GIT_COMMIT=$(shell git rev-list -1 HEAD)
-GO_COMPILE=mobylinux/go-compile:a2ff853b00d687f845d0f67189fa645a567c006e@sha256:09fff8a5c022fc9ead35b2779209c043196b09193c6e61d98603d402c0971f03
+GO_COMPILE=mobylinux/go-compile:90607983001c2789911afabf420394d51f78ced8@sha256:188beb574d4702a92fa3396a57cabaade28003c82f9413c3121a370ff8becea4
MOBY?=bin/moby
GOOS=$(shell uname -s | tr '[:upper:]' '[:lower:]')
diff --git a/docs/vendoring.md b/docs/vendoring.md
new file mode 100644
index 000000000..dc6225d66
--- /dev/null
+++ b/docs/vendoring.md
@@ -0,0 +1,57 @@
+vendoring
+=========
+
+The Go code in this repo depends on a number of Go libraries.
+Theses are vendored in to the `vendor` directory using [`vndr`](https://github.com/lk4d4/vndr)
+The `vendor.conf` file contains a list of the repositories and the git SHA or branch name that should be vendored
+
+## Updating dependencies
+
+Update `vendor.conf` with the dependency that you would like to add.
+Details of usage of the `vndr` tool and the format of `vendor.conf` can be found [here](https://github.com/LK4D4/vndr/blob/master/README.md)
+
+Once done, you must run the `vndr` tool to add the necessary files to the `vendor` directory.
+The easiest way to do this is in a container.
+
+## Updating in a container
+
+To update all dependencies:
+
+```
+docker run -it --rm \
+-v $(PWD):/go/src/github.com/docker/moby \
+-w /go/src/github.com/docker/moby \
+--entrypoint /go/bin/vndr \
+mobylinux/go-compile:90607983001c2789911afabf420394d51f78ced8
+```
+
+To update a single dependency:
+
+```
+docker run -it --rm \
+-v $(PWD):/go/src/github.com/docker/moby \
+-w /go/src/github.com/docker/moby \
+--entrypoint /go/bin/vndr \
+mobylinux/go-compile:90607983001c2789911afabf420394d51f78ced8 \
+github.com/docker/docker
+```
+
+## Updating locally
+
+First you must install `vndr` and ensure that `$GOPATH/bin` is on your `$PATH`
+
+```
+go get -u github.com/LK4D4/vndr
+```
+
+To update all dependencies:
+
+```
+vndr
+```
+
+To update a single dependency:
+
+```
+vndr github.com/docker/docker
+```
diff --git a/tools/go-compile/Dockerfile b/tools/go-compile/Dockerfile
index e4e6c1e30..061d862d1 100644
--- a/tools/go-compile/Dockerfile
+++ b/tools/go-compile/Dockerfile
@@ -2,6 +2,7 @@ FROM alpine:3.5
RUN apk update && apk add --no-cache build-base git go
ENV GOPATH=/go PATH=$PATH:/go/bin
RUN go get -u github.com/golang/lint/golint
+RUN go get -u github.com/LK4D4/vndr
COPY . ./