From 8f85e11e6af37816da2c930593a676db3a2f238c Mon Sep 17 00:00:00 2001 From: "Dr. Stefan Schimanski" Date: Mon, 23 Jan 2017 16:34:35 +0100 Subject: [PATCH 1/3] hack/verify-golint.sh: add authorative staging packages --- hack/verify-golint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hack/verify-golint.sh b/hack/verify-golint.sh index 74242ac3d58..76031449ccc 100755 --- a/hack/verify-golint.sh +++ b/hack/verify-golint.sh @@ -55,7 +55,7 @@ export IFS=$'\n' # as the prefix, however if we run it outside it returns the full path of the file # with a leading underscore. We'll need to support both scenarios for all_packages. all_packages=( - $(go list -e ./... | egrep -v "/(third_party|vendor|staging|generated|clientset_generated)" | sed -e 's|^k8s.io/kubernetes/||' -e "s|^_${KUBE_ROOT}/\?||") + $(go list -e ./... | egrep -v "/(third_party|vendor|staging/src/k8s.io/client-go/pkg|generated|clientset_generated)" | sed -e 's|^k8s.io/kubernetes/||' -e "s|^_${KUBE_ROOT}/\?||") ) linted_packages=( $(cat $linted_file) From d0eb7f88a6dc3965d879c2bed97c238fc2345a49 Mon Sep 17 00:00:00 2001 From: "Dr. Stefan Schimanski" Date: Mon, 23 Jan 2017 16:38:09 +0100 Subject: [PATCH 2/3] Reset hack/.linted_packages --- hack/.linted_packages | 87 +++++++++++++------------------------------ 1 file changed, 26 insertions(+), 61 deletions(-) diff --git a/hack/.linted_packages b/hack/.linted_packages index 90aa056c90a..fe1adccf2fc 100644 --- a/hack/.linted_packages +++ b/hack/.linted_packages @@ -8,7 +8,6 @@ cmd/genkubedocs cmd/genman cmd/genswaggertypedocs cmd/genyaml -cmd/integration cmd/kube-aggregator cmd/kube-aggregator/pkg/apis/apiregistration/install cmd/kube-aggregator/pkg/client/informers @@ -25,7 +24,6 @@ cmd/kube-controller-manager/app/options cmd/kube-discovery cmd/kube-proxy cmd/kubeadm -cmd/kubeadm cmd/kubeadm/app/apis/kubeadm/install cmd/kubeadm/app/phases/apiconfig cmd/kubeadm/app/phases/certs @@ -34,24 +32,17 @@ cmd/kubelet cmd/libs/go2idl/client-gen cmd/libs/go2idl/client-gen/generators cmd/libs/go2idl/client-gen/test_apis/testgroup/install -cmd/libs/go2idl/client-gen/testoutput/clientset_generated/test_internalclientset/typed/testgroup.k8s.io/internalversion cmd/libs/go2idl/conversion-gen cmd/libs/go2idl/deepcopy-gen cmd/libs/go2idl/defaulter-gen -cmd/libs/go2idl/generator cmd/libs/go2idl/go-to-protobuf cmd/libs/go2idl/go-to-protobuf/protoc-gen-gogo cmd/libs/go2idl/import-boss cmd/libs/go2idl/informer-gen cmd/libs/go2idl/lister-gen cmd/libs/go2idl/openapi-gen -cmd/libs/go2idl/parser cmd/libs/go2idl/set-gen -cmd/libs/go2idl/set-gen/generators cmd/linkcheck -docs/user-guide/environment-guide/containers/backend -docs/user-guide/environment-guide/containers/show -docs/user-guide/liveness/image examples examples/apiserver/server examples/explorer @@ -75,11 +66,9 @@ pkg/api/resource pkg/api/service pkg/api/v1 pkg/api/v1/service -pkg/apimachinery pkg/apis/abac/v0 pkg/apis/abac/v1beta1 pkg/apis/apps/install -pkg/apis/authentication.k8s.io/install pkg/apis/authentication/install pkg/apis/authorization/install pkg/apis/autoscaling/install @@ -97,8 +86,6 @@ pkg/apis/rbac/install pkg/apis/rbac/v1alpha1 pkg/apis/storage/install pkg/apis/storage/validation -pkg/auth/authenticator -pkg/auth/authorizer/union pkg/client/cache pkg/client/conditions pkg/client/informers/informers_generated/apps @@ -131,7 +118,6 @@ pkg/client/informers/informers_generated/storage pkg/client/informers/informers_generated/storage/internalversion pkg/client/informers/informers_generated/storage/v1beta1 pkg/client/listers/apps/internalversion -pkg/client/listers/apps/v1alpha1 pkg/client/listers/apps/v1beta1 pkg/client/listers/authentication/internalversion pkg/client/listers/authentication/v1beta1 @@ -160,34 +146,23 @@ pkg/client/listers/storage/internalversion pkg/client/listers/storage/v1beta1 pkg/client/metrics pkg/client/metrics/prometheus -pkg/client/restclient/watch pkg/client/testing/core pkg/client/typed/discovery pkg/client/unversioned -pkg/client/unversioned/adapters/internalclientset -pkg/client/unversioned/auth pkg/client/unversioned/remotecommand pkg/cloudprovider/providers pkg/cloudprovider/providers/azure pkg/cloudprovider/providers/cloudstack -pkg/controller/framework -pkg/controller/volume pkg/controller/volume/attachdetach/cache pkg/controller/volume/attachdetach/populator pkg/controller/volume/attachdetach/reconciler -pkg/controller/volume/cache -pkg/controller/volume/populator -pkg/controller/volume/reconciler -pkg/controller/volume/statusupdater pkg/conversion pkg/conversion/queryparams pkg/credentialprovider/aws pkg/fields pkg/genericapiserver -pkg/genericapiserver/endpoints/audit pkg/genericapiserver/endpoints/handlers/responsewriters pkg/genericapiserver/endpoints/openapi -pkg/genericapiserver/endpoints/request pkg/genericapiserver/registry pkg/genericapiserver/server/filters pkg/genericapiserver/server/mux @@ -197,14 +172,9 @@ pkg/kubelet/api pkg/kubelet/container pkg/kubelet/envvars pkg/kubelet/eviction -pkg/kubelet/sysctls pkg/kubelet/util/csr pkg/kubelet/util/format pkg/kubelet/util/ioutils -pkg/kubelet/volume -pkg/kubelet/volume/cache -pkg/kubelet/volume/populator -pkg/kubelet/volume/reconciler pkg/kubelet/volumemanager pkg/kubelet/volumemanager/cache pkg/kubelet/volumemanager/populator @@ -216,9 +186,6 @@ pkg/quota pkg/quota/install pkg/registry pkg/registry/authorization/util -pkg/registry/clusterrole/storage -pkg/registry/clusterrolebinding/storage -pkg/registry/configmap/storage pkg/registry/core/configmap/storage pkg/registry/core/endpoint pkg/registry/core/node/rest @@ -227,34 +194,20 @@ pkg/registry/core/rangeallocation pkg/registry/core/service/ipallocator/controller pkg/registry/core/service/ipallocator/storage pkg/registry/core/serviceaccount -pkg/registry/endpoint pkg/registry/extensions/podsecuritypolicy/storage pkg/registry/extensions/thirdpartyresource pkg/registry/extensions/thirdpartyresource/storage -pkg/registry/node/rest -pkg/registry/pod/storage -pkg/registry/podsecuritypolicy/storage -pkg/registry/rangeallocation pkg/registry/rbac/clusterrole/storage pkg/registry/rbac/clusterrolebinding/storage pkg/registry/rbac/role/storage pkg/registry/rbac/rolebinding/storage -pkg/registry/role/storage -pkg/registry/rolebinding/storage -pkg/registry/service/ipallocator/controller -pkg/registry/service/ipallocator/storage -pkg/registry/serviceaccount -pkg/registry/thirdpartyresource -pkg/registry/thirdpartyresource/storage pkg/runtime pkg/runtime/serializer pkg/runtime/serializer/json pkg/runtime/serializer/protobuf pkg/runtime/serializer/recognizer -pkg/runtime/serializer/recognizer/testing pkg/runtime/serializer/streaming pkg/runtime/serializer/versioning -pkg/runtime/serializer/yaml pkg/security pkg/security/podsecuritypolicy/apparmor pkg/security/podsecuritypolicy/capabilities @@ -265,15 +218,11 @@ pkg/storage/etcd3 pkg/storage/storagebackend/factory pkg/types pkg/util/async -pkg/util/cert -pkg/util/codeinspector pkg/util/errors pkg/util/flock -pkg/util/flushwriter pkg/util/framer pkg/util/goroutinemap pkg/util/hash -pkg/util/homedir pkg/util/i18n pkg/util/interrupt pkg/util/io @@ -285,9 +234,6 @@ pkg/util/metrics pkg/util/net pkg/util/netsh pkg/util/rand -pkg/util/ratelimit -pkg/util/replicaset -pkg/util/restoptions pkg/util/runtime pkg/util/sets pkg/util/tail @@ -324,14 +270,34 @@ plugin/pkg/auth/authenticator plugin/pkg/auth/authenticator/password plugin/pkg/auth/authenticator/password/allow plugin/pkg/auth/authenticator/request/basicauth -plugin/pkg/auth/authenticator/request/union -plugin/pkg/auth/authenticator/request/x509 plugin/pkg/auth/authorizer plugin/pkg/auth/authorizer/rbac/bootstrappolicy -plugin/pkg/client/auth -plugin/pkg/client/auth/gcp -test/e2e/cleanup -test/e2e/generated +staging/src/k8s.io/apimachinery/pkg/api/errors +staging/src/k8s.io/apimachinery/pkg/apimachinery +staging/src/k8s.io/apimachinery/pkg/conversion/queryparams +staging/src/k8s.io/apimachinery/pkg/runtime +staging/src/k8s.io/apimachinery/pkg/runtime/serializer/json +staging/src/k8s.io/apimachinery/pkg/runtime/serializer/recognizer/testing +staging/src/k8s.io/apimachinery/pkg/runtime/serializer/versioning +staging/src/k8s.io/apimachinery/pkg/runtime/serializer/yaml +staging/src/k8s.io/apimachinery/pkg/util/json +staging/src/k8s.io/apimachinery/pkg/util/validation/field +staging/src/k8s.io/apimachinery/pkg/version +staging/src/k8s.io/apimachinery/pkg/watch +staging/src/k8s.io/apiserver/pkg/authentication/authenticator +staging/src/k8s.io/apiserver/pkg/authentication/request/union +staging/src/k8s.io/apiserver/pkg/authentication/request/x509 +staging/src/k8s.io/apiserver/pkg/authorization/union +staging/src/k8s.io/apiserver/pkg/endpoints/request +staging/src/k8s.io/apiserver/pkg/server +staging/src/k8s.io/apiserver/pkg/storage/names +staging/src/k8s.io/apiserver/pkg/util/flushwriter +staging/src/k8s.io/client-go/discovery +staging/src/k8s.io/client-go/plugin/pkg/client/auth +staging/src/k8s.io/client-go/plugin/pkg/client/auth/gcp +staging/src/k8s.io/client-go/rest/watch +staging/src/k8s.io/client-go/tools/auth +staging/src/k8s.io/client-go/tools/metrics test/e2e/perftype test/e2e_node/runner/local test/images/clusterapi-tester @@ -355,4 +321,3 @@ test/integration/objectmeta test/integration/openshift test/soak/cauldron test/soak/serve_hostnames -third_party/forked/golang/expansion From 81461f7214497c72dbf814efc8f74e284c8c69a2 Mon Sep 17 00:00:00 2001 From: "Dr. Stefan Schimanski" Date: Mon, 23 Jan 2017 16:51:14 +0100 Subject: [PATCH 3/3] hack/verify-golint: enforce cleanup of old packages --- hack/verify-golint.sh | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/hack/verify-golint.sh b/hack/verify-golint.sh index 76031449ccc..b8c575b94ab 100755 --- a/hack/verify-golint.sh +++ b/hack/verify-golint.sh @@ -76,6 +76,12 @@ for p in "${all_packages[@]}"; do fi done +# Check that all linted_packages actually still exist +gone=() +for p in "${linted_packages[@]}"; do + array_contains "$p" "${all_packages[@]}" || gone+=( "$p" ) +done + # Check to be sure all the packages that should pass lint are. if [ ${#errors[@]} -eq 0 ]; then echo 'Congratulations! All Go source files have been linted.' @@ -94,18 +100,29 @@ fi # check to make sure all packages that pass lint are in the linted file. echo -if [ ${#linted[@]} -eq 0 ]; then +if [ ${#linted[@]} -eq 0 -a ${#gone[@]} -eq 0 ]; then echo 'Success! All packages that should pass lint are listed in the linted file.' else { - echo "Some packages passed golint but are not listed in hack/.linted_packages." - echo "Please add them in alphabetical order:" - echo - for p in "${linted[@]}"; do - echo " echo $p >> hack/.linted_packages" - done - echo " LC_ALL=C sort -o hack/.linted_packages hack/.linted_packages" - echo + if [ ${#gone[@]} -gt 0 ]; then + echo "Some packages in hack/.linted_packages do not exist anymore. Please remove them" + echo "from hack/.linted_packages:" + echo + for p in "${gone[@]}"; do + echo " $p" + done + echo + fi + if [ ${#linted[@]} -gt 0 ]; then + echo "Some packages passed golint but are not listed in hack/.linted_packages." + echo "Please add them in alphabetical order:" + echo + for p in "${linted[@]}"; do + echo " echo $p >> hack/.linted_packages" + done + echo " LC_ALL=C sort -o hack/.linted_packages hack/.linted_packages" + echo + fi echo 'You can test via this script and commit the result.' echo } >&2