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

ci: enforce that dep prune is run #1161

Merged
merged 1 commit into from
Sep 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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