From a764adbf1b24a6a61b783a2aa8b8ac00f2b8cabd Mon Sep 17 00:00:00 2001 From: Paul Hinze Date: Fri, 30 Jan 2015 15:43:47 -0600 Subject: [PATCH] Makefile: new deps strategy fixes deps in branches Currently when running `make updatedeps` from a branch, the dependency list from master ends up getting used. We tried to work around this in 35490f7812395ff46fcba52989b3fbc3e44215c3, and got part way there, but here's what was happening: - record the current SHA - run `go get -f -u -v ./...` which ends up checking out master - master is checked out early in the `go get` process, which means all subsequent dependencies are resolved from master - re-checkout the recorded SHA - run tests This works in most cases, except when the branch being tested actually changes the list of dependencies in some way. Here we move away from letting `go get -v` walk through everything in `./...`, instead building our own list of dependencies with the help of `deplist`. We can then filter terraform packages out from the list, so they don't get touched, and safely update the rest. This should solve problems like those observed in #899 and #900. __Note__: had to add a feature to deplist to make this work properly; see https://github.com/phinze/deplist/commit/016ef97111533b1b8500b1d0db55133e7dba495a Working on getting it accepted upstream. --- Makefile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index fde469c9c..649fd1b32 100644 --- a/Makefile +++ b/Makefile @@ -32,14 +32,15 @@ testrace: generate # updatedeps installs all the dependencies that Terraform needs to run # and build. updatedeps: - $(eval REF := $(shell sh -c "\ - git symbolic-ref --short HEAD 2>/dev/null \ - || git rev-parse HEAD")) + go get -u github.com/phinze/deplist go get -u github.com/mitchellh/gox go get -u golang.org/x/tools/cmd/stringer go get -u golang.org/x/tools/cmd/vet - go get -f -u -v ./... - git checkout $(REF) + go list github.com/hashicorp/terraform/... \ + | xargs -n 1 deplist -s \ + | grep -v github.com/hashicorp/terraform \ + | sort -u \ + | xargs go get -f -u -v # vet runs the Go source code static analysis tool `vet` to find # any common errors.