Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Commit

Permalink
CI: enforce that dep prune is run
Browse files Browse the repository at this point in the history
  • Loading branch information
sdboyer committed Sep 12, 2017
1 parent d1f8b38 commit 50bcf4c
Show file tree
Hide file tree
Showing 86 changed files with 4 additions and 15,598 deletions.
16 changes: 4 additions & 12 deletions hack/validate-vendor.bash
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,18 @@ files=( $(validate_diff --diff-filter=ACMR --name-only -- 'Gopkg.toml' 'Gopkg.lo
unset IFS

if [ ${#files[@]} -gt 0 ]; then
# This will delete memo section from Gopkg.lock
# See https://github.com/golang/dep/issues/645 for more info
# This should go away after -vendor-only flag will be implemented
# sed -i not used because it works different on MacOS and Linux
TMP_FILE=`mktemp /tmp/Gopkg.lock.XXXXXXXXXX`
sed '/memo = \S*/d' Gopkg.lock > $TMP_FILE
mv $TMP_FILE Gopkg.lock

# We run ensure to and see if we have a diff afterwards
go build ./cmd/dep
./dep ensure
./dep ensure -vendor-only
./dep prune
# Let see if the working directory is clean
diffs="$(git status --porcelain -- vendor Gopkg.toml Gopkg.lock 2>/dev/null)"
if [ "$diffs" ]; then
{
echo 'The result of ensure differs'
echo 'The contents of vendor differ after "dep ensure && dep prune":'
echo
echo "$diffs"
echo
echo 'Please vendor your package with github.com/golang/dep.'
echo 'Make sure these commands have been run before committing.'
echo
} >&2
false
Expand Down
Loading

0 comments on commit 50bcf4c

Please sign in to comment.