Skip to content

Commit

Permalink
Add version in filename of dep binary to prevent version conflicts
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Lingerfelt <[email protected]>
  • Loading branch information
klingerf committed Aug 17, 2018
1 parent 1fe7e7b commit 54d9e78
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ web/app/dist
web/app/yarn-error.log
.protoc
.gorun
.dep
.dep.exe
.dep*
15 changes: 4 additions & 11 deletions bin/dep
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ set -eu
# Keep this in sync with Dockerfile-go-deps. The digests will be different for each
# version and each platform; they can be found in the *.sha256 files alongside the
# executables at ${dep_base_url}.
depversion=v0.5.0
dep_base_url="https://github.com/golang/dep/releases/download/${depversion}/"
depversion=0.5.0
dep_base_url="https://github.com/golang/dep/releases/download/v${depversion}/"

cd "$(pwd -P)"

Expand All @@ -23,24 +23,17 @@ elif [ "$(uname -o)" = "Msys" ]; then
exe=.exe
fi

depbin="${rootdir}/.dep${exe}"
depbin="${rootdir}/.dep-${depversion}${exe}"
depurl="${dep_base_url}dep-${os}-amd64${exe}"

if [ -f "$depbin" ]; then
version=$($depbin version | grep "^ version" | awk '{print $3}' | awk -F '-' '{print $1}')
if [ "$version" != "$depversion" ]; then
rm "$depbin"
fi
fi

if [ ! -f "$depbin" ]; then
tmp=$(mktemp -d -t dep.XXX)
(
cd "$tmp"
curl -L --silent --fail -o depbin "$depurl"
sha=$(curl -L --silent --fail "${depurl}.sha256" | awk '{ print $1 }')
(echo "$sha *depbin" | shasum -c -a 256 -p -s -) || {
echo "Actual digest of $depbin does not match expected digest."
echo "Actual digest of $(pwd)/depbin does not match expected digest."
exit 1
}
chmod +x depbin
Expand Down

0 comments on commit 54d9e78

Please sign in to comment.