Skip to content

Commit

Permalink
Fix godep-save by ignoring cmd/cluster-capacity and cmd/service-catal…
Browse files Browse the repository at this point in the history
…og dirs.
  • Loading branch information
Avesh Agarwal committed Jun 22, 2017
1 parent df9c0ed commit e1b2918
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
10 changes: 8 additions & 2 deletions hack/godep-save.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ REQUIRED_BINS=(
"k8s.io/kubernetes/test/e2e/generated"
"github.com/onsi/ginkgo/ginkgo"
"github.com/jteeuwen/go-bindata/go-bindata"
"./..."
)

TMPGOPATH=`mktemp -d`
Expand Down Expand Up @@ -164,8 +163,15 @@ fork-with-fake-packages github.com/docker/docker \
# kubernetes tests, we have to extract the missing test dependencies and run godep-save again
# until we converge. Because we rsync kubernetes itself above, two iterations should be enough.
MISSING_TEST_DEPS=""

# Find subdirs in origin/ and cmd/ excluding
# cmd/cluster-capacity and cmd/service-catalog and doc.go
for dir in $(os::util::list_go_src_dirs); do
REQUIRED_ALL_DIRS+=" ${dir}/..."
done

while true; do
godep-save -t "${REQUIRED_BINS[@]}" ${MISSING_TEST_DEPS}
godep-save -t "${REQUIRED_BINS[@]}" ${REQUIRED_ALL_DIRS} ${MISSING_TEST_DEPS}
NEW_MISSING_TEST_DEPS="$(missing-test-deps)"
if [ -z "${NEW_MISSING_TEST_DEPS}" ]; then
break
Expand Down
16 changes: 16 additions & 0 deletions hack/lib/util/misc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -233,3 +233,19 @@ function os::util::list_go_src_files() {
\) -name '*.go' | sort -u
}
readonly -f os::util::list_go_src_files

# os::util::list_go_src_dirs lists dirs in origin/ and cmd/ dirs excluding
# cmd/cluster-capacity and cmd/service-catalog and doc.go useful for tools that
# iterate over source to provide vetting or linting, or for godep-save etc.
#
# Globals:
# None
# Arguments:
# None
# Returns:
# None
function os::util::list_go_src_dirs() {
os::util::list_go_src_files | cut -d '/' -f 1-2 | grep -v ".go$" | grep -v "^./cmd" | LC_ALL=C sort -u
os::util::list_go_src_files | grep "^./cmd/"| cut -d '/' -f 1-3 | grep -v ".go$" | LC_ALL=C sort -u
}
readonly -f os::util::list_go_src_dirs
4 changes: 1 addition & 3 deletions hack/verify-govet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ function govet_blacklist_contains() {
return 1
}

test_dirs="$(os::util::list_go_src_files | cut -d '/' -f 1-2 | sort -u | grep -v "^./cmd")"
test_dirs+=" $(os::util::list_go_src_files | grep "^./cmd/"| cut -d '/' -f 1-3 | LC_ALL=C sort -u)"
for test_dir in ${test_dirs}; do
for test_dir in $(os::util::list_go_src_dirs); do
if ! result="$(go tool vet -shadow=false "${test_dir}" 2>&1)"; then
while read -r line; do
if ! govet_blacklist_contains "${line}"; then
Expand Down

0 comments on commit e1b2918

Please sign in to comment.