From e6841d0a27b5c3beeba76ad743280d4e0ec0b6a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Tue, 22 Mar 2016 15:30:59 +0100 Subject: [PATCH] Do not clean test-only dependencies from vendor packages Instead of only checking dependencies of the "main" packages, include also test dependencies of all subpackages of the project, and their transitive dependencies. --- hack/.vendor-helpers.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hack/.vendor-helpers.sh b/hack/.vendor-helpers.sh index ef0402f9..d5d8661f 100755 --- a/hack/.vendor-helpers.sh +++ b/hack/.vendor-helpers.sh @@ -46,10 +46,7 @@ clone() { } clean() { - local packages=( - "${PROJECT}/cmd/skopeo" # package main - "${PROJECT}/integration" # package main - ) + local packages=($(go list -e ./... | grep -v "^${PROJECT}/vendor")) local platforms=( linux/amd64 linux/386 ) local buildTags=( ) @@ -66,6 +63,10 @@ clean() { go list -e -tags "$buildTags" -f '{{join .TestImports "\n"}}' "${packages[@]}" done | grep -vE "^${PROJECT}" | sort -u ) ) + # .TestImports does not include indirect dependencies, so do one more iteration. + imports+=( $( + go list -e -f '{{join .Deps "\n"}}' "${imports[@]}" | grep -vE "^${PROJECT}" | sort -u + ) ) imports=( $(go list -e -f '{{if not .Standard}}{{.ImportPath}}{{end}}' "${imports[@]}") ) unset IFS