From e16ee0b68ef900a0cb03194d20dbf9a4e6fc736c Mon Sep 17 00:00:00 2001 From: Roy Hvaara Date: Tue, 5 Nov 2019 22:59:42 +0100 Subject: [PATCH] Support comments in hack/.golint_failures --- hack/.golint_failures | 3 ++- hack/verify-golint.sh | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/hack/.golint_failures b/hack/.golint_failures index 812757f2d41..0efcba820b6 100644 --- a/hack/.golint_failures +++ b/hack/.golint_failures @@ -1,3 +1,4 @@ +# Apart from this line, only trailing comments are supported cmd/cloud-controller-manager/app/apis/config/v1alpha1 cmd/kube-apiserver/app cmd/kubeadm/app/apis/kubeadm/v1beta1 @@ -228,7 +229,7 @@ pkg/util/ebtables pkg/util/goroutinemap/exponentialbackoff pkg/util/iptables pkg/util/iptables/testing -pkg/util/labels +pkg/util/labels # See previous effort in PR #80685 pkg/util/mount pkg/util/oom pkg/util/procfs diff --git a/hack/verify-golint.sh b/hack/verify-golint.sh index 10aaf9bafc3..a398cb6f3f5 100755 --- a/hack/verify-golint.sh +++ b/hack/verify-golint.sh @@ -46,8 +46,10 @@ export IFS=$'\n' # with a leading underscore. We'll need to support both scenarios for all_packages. all_packages=() while IFS='' read -r line; do all_packages+=("$line"); done < <(go list -e ./... | grep -vE "/(third_party|vendor|staging/src/k8s.io/client-go/pkg|generated|clientset_generated)" | sed -e 's|^k8s.io/kubernetes/||' -e "s|^_\(${KUBE_ROOT}/\)\{0,1\}||") +# The regex below removes any "#" character and anything behind it and including any +# whitespace before it. Then it removes empty lines. failing_packages=() -while IFS='' read -r line; do failing_packages+=("$line"); done < <(cat "$failure_file") +while IFS='' read -r line; do failing_packages+=("$line"); done < <(sed -e 's/[[:blank:]]*#.*//' -e '/^$/d' "$failure_file") unset IFS errors=() not_failing=()