From 7425d4f61c3ce9cde9620154d19600a4d5467326 Mon Sep 17 00:00:00 2001 From: Manuel de Brito Fontes Date: Tue, 10 May 2016 13:01:19 -0300 Subject: [PATCH] Fix verify scripts to support vendor directory --- .travis.yml | 2 -- hack/boilerplate/boilerplate.py | 2 +- hack/verify-flags-underscore.py | 4 +++- hack/verify-gofmt.sh | 1 + hack/verify-golint.sh | 13 ++++++++++--- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index e23858b48e..c655b588f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,6 @@ language: go matrix: include: - - go: 1.4.3 - - go: 1.5.3 - go: 1.6 install: diff --git a/hack/boilerplate/boilerplate.py b/hack/boilerplate/boilerplate.py index 0bb5e0efd1..831eed43f3 100755 --- a/hack/boilerplate/boilerplate.py +++ b/hack/boilerplate/boilerplate.py @@ -95,7 +95,7 @@ def file_passes(filename, refs, regexs): def file_extension(filename): return os.path.splitext(filename)[1].split(".")[-1].lower() -skipped_dirs = ['Godeps', 'third_party', '_output', '.git'] +skipped_dirs = ['Godeps', 'third_party', '_output', '.git', 'vendor'] def normalize_files(files): newfiles = [] for pathname in files: diff --git a/hack/verify-flags-underscore.py b/hack/verify-flags-underscore.py index 850bf3e851..6ce5b23dce 100755 --- a/hack/verify-flags-underscore.py +++ b/hack/verify-flags-underscore.py @@ -63,6 +63,8 @@ def get_all_files(rootdir): files.remove('exceptions.txt') if 'known-flags.txt' in files: files.remove('known-flags.txt') + if 'vendor' in dirs: + dirs.remove('vendor') for name in files: if name.endswith(".svg"): @@ -77,7 +79,7 @@ def get_all_files(rootdir): def normalize_files(rootdir, files): newfiles = [] - a = ['Godeps', 'third_party', 'exceptions.txt', 'known-flags.txt'] + a = ['Godeps', 'vendor', 'third_party', 'exceptions.txt', 'known-flags.txt'] for f in files: if any(x in f for x in a): continue diff --git a/hack/verify-gofmt.sh b/hack/verify-gofmt.sh index 170acc41db..f11b735a34 100755 --- a/hack/verify-gofmt.sh +++ b/hack/verify-gofmt.sh @@ -40,6 +40,7 @@ find_files() { -o -wholename './target' \ -o -wholename '*/third_party/*' \ -o -wholename '*/Godeps/*' \ + -o -wholename '*/vendor/*' \ \) -prune \ \) -name '*.go' } diff --git a/hack/verify-golint.sh b/hack/verify-golint.sh index bbc1a4b400..5d72760658 100755 --- a/hack/verify-golint.sh +++ b/hack/verify-golint.sh @@ -30,10 +30,17 @@ fi cd "${KUBE_ROOT}" GOLINT=${GOLINT:-"golint"} -bad_files=$($GOLINT -min_confidence=0.9 ./...) -if [[ -n "${bad_files}" ]]; then +PACKAGES=($(go list ./... | grep -v /vendor/)) +bad_files=() +for package in "${PACKAGES[@]}"; do + out=$("${GOLINT}" -min_confidence=0.9 "${package}") + if [[ -n "${out}" ]]; then + bad_files+=("${out}") + fi +done +if [[ "${#bad_files[@]}" -ne 0 ]]; then echo "!!! '$GOLINT' problems: " - echo "${bad_files}" + echo "${bad_files[@]}" exit 1 fi