Merge pull request #40303 from sttts/sttts-golint-staging

Automatic merge from submit-queue (batch tested with PRs 40303, 40316)

Reactivate golint in staging

Run golint against staging with `staging/src/k8s.io/client-go/pkg` as the only exception. While doing this reset `hack/.linted_packages` which collected a lot of cruft. We now enforce that gone packages are removed.
This commit is contained in:
Kubernetes Submit Queue 2017-01-24 01:57:10 -08:00 committed by GitHub
commit 65ca1f98cb
2 changed files with 53 additions and 71 deletions

View File

@ -8,7 +8,6 @@ cmd/genkubedocs
cmd/genman cmd/genman
cmd/genswaggertypedocs cmd/genswaggertypedocs
cmd/genyaml cmd/genyaml
cmd/integration
cmd/kube-aggregator cmd/kube-aggregator
cmd/kube-aggregator/pkg/apis/apiregistration/install cmd/kube-aggregator/pkg/apis/apiregistration/install
cmd/kube-aggregator/pkg/client/informers cmd/kube-aggregator/pkg/client/informers
@ -25,7 +24,6 @@ cmd/kube-controller-manager/app/options
cmd/kube-discovery cmd/kube-discovery
cmd/kube-proxy cmd/kube-proxy
cmd/kubeadm cmd/kubeadm
cmd/kubeadm
cmd/kubeadm/app/apis/kubeadm/install cmd/kubeadm/app/apis/kubeadm/install
cmd/kubeadm/app/phases/apiconfig cmd/kubeadm/app/phases/apiconfig
cmd/kubeadm/app/phases/certs cmd/kubeadm/app/phases/certs
@ -34,24 +32,17 @@ cmd/kubelet
cmd/libs/go2idl/client-gen cmd/libs/go2idl/client-gen
cmd/libs/go2idl/client-gen/generators cmd/libs/go2idl/client-gen/generators
cmd/libs/go2idl/client-gen/test_apis/testgroup/install 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/conversion-gen
cmd/libs/go2idl/deepcopy-gen cmd/libs/go2idl/deepcopy-gen
cmd/libs/go2idl/defaulter-gen cmd/libs/go2idl/defaulter-gen
cmd/libs/go2idl/generator
cmd/libs/go2idl/go-to-protobuf cmd/libs/go2idl/go-to-protobuf
cmd/libs/go2idl/go-to-protobuf/protoc-gen-gogo cmd/libs/go2idl/go-to-protobuf/protoc-gen-gogo
cmd/libs/go2idl/import-boss cmd/libs/go2idl/import-boss
cmd/libs/go2idl/informer-gen cmd/libs/go2idl/informer-gen
cmd/libs/go2idl/lister-gen cmd/libs/go2idl/lister-gen
cmd/libs/go2idl/openapi-gen cmd/libs/go2idl/openapi-gen
cmd/libs/go2idl/parser
cmd/libs/go2idl/set-gen cmd/libs/go2idl/set-gen
cmd/libs/go2idl/set-gen/generators
cmd/linkcheck cmd/linkcheck
docs/user-guide/environment-guide/containers/backend
docs/user-guide/environment-guide/containers/show
docs/user-guide/liveness/image
examples examples
examples/apiserver/server examples/apiserver/server
examples/explorer examples/explorer
@ -75,11 +66,9 @@ pkg/api/resource
pkg/api/service pkg/api/service
pkg/api/v1 pkg/api/v1
pkg/api/v1/service pkg/api/v1/service
pkg/apimachinery
pkg/apis/abac/v0 pkg/apis/abac/v0
pkg/apis/abac/v1beta1 pkg/apis/abac/v1beta1
pkg/apis/apps/install pkg/apis/apps/install
pkg/apis/authentication.k8s.io/install
pkg/apis/authentication/install pkg/apis/authentication/install
pkg/apis/authorization/install pkg/apis/authorization/install
pkg/apis/autoscaling/install pkg/apis/autoscaling/install
@ -97,8 +86,6 @@ pkg/apis/rbac/install
pkg/apis/rbac/v1alpha1 pkg/apis/rbac/v1alpha1
pkg/apis/storage/install pkg/apis/storage/install
pkg/apis/storage/validation pkg/apis/storage/validation
pkg/auth/authenticator
pkg/auth/authorizer/union
pkg/client/cache pkg/client/cache
pkg/client/conditions pkg/client/conditions
pkg/client/informers/informers_generated/apps 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/internalversion
pkg/client/informers/informers_generated/storage/v1beta1 pkg/client/informers/informers_generated/storage/v1beta1
pkg/client/listers/apps/internalversion pkg/client/listers/apps/internalversion
pkg/client/listers/apps/v1alpha1
pkg/client/listers/apps/v1beta1 pkg/client/listers/apps/v1beta1
pkg/client/listers/authentication/internalversion pkg/client/listers/authentication/internalversion
pkg/client/listers/authentication/v1beta1 pkg/client/listers/authentication/v1beta1
@ -160,34 +146,23 @@ pkg/client/listers/storage/internalversion
pkg/client/listers/storage/v1beta1 pkg/client/listers/storage/v1beta1
pkg/client/metrics pkg/client/metrics
pkg/client/metrics/prometheus pkg/client/metrics/prometheus
pkg/client/restclient/watch
pkg/client/testing/core pkg/client/testing/core
pkg/client/typed/discovery pkg/client/typed/discovery
pkg/client/unversioned pkg/client/unversioned
pkg/client/unversioned/adapters/internalclientset
pkg/client/unversioned/auth
pkg/client/unversioned/remotecommand pkg/client/unversioned/remotecommand
pkg/cloudprovider/providers pkg/cloudprovider/providers
pkg/cloudprovider/providers/azure pkg/cloudprovider/providers/azure
pkg/cloudprovider/providers/cloudstack pkg/cloudprovider/providers/cloudstack
pkg/controller/framework
pkg/controller/volume
pkg/controller/volume/attachdetach/cache pkg/controller/volume/attachdetach/cache
pkg/controller/volume/attachdetach/populator pkg/controller/volume/attachdetach/populator
pkg/controller/volume/attachdetach/reconciler 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
pkg/conversion/queryparams pkg/conversion/queryparams
pkg/credentialprovider/aws pkg/credentialprovider/aws
pkg/fields pkg/fields
pkg/genericapiserver pkg/genericapiserver
pkg/genericapiserver/endpoints/audit
pkg/genericapiserver/endpoints/handlers/responsewriters pkg/genericapiserver/endpoints/handlers/responsewriters
pkg/genericapiserver/endpoints/openapi pkg/genericapiserver/endpoints/openapi
pkg/genericapiserver/endpoints/request
pkg/genericapiserver/registry pkg/genericapiserver/registry
pkg/genericapiserver/server/filters pkg/genericapiserver/server/filters
pkg/genericapiserver/server/mux pkg/genericapiserver/server/mux
@ -197,14 +172,9 @@ pkg/kubelet/api
pkg/kubelet/container pkg/kubelet/container
pkg/kubelet/envvars pkg/kubelet/envvars
pkg/kubelet/eviction pkg/kubelet/eviction
pkg/kubelet/sysctls
pkg/kubelet/util/csr pkg/kubelet/util/csr
pkg/kubelet/util/format pkg/kubelet/util/format
pkg/kubelet/util/ioutils 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
pkg/kubelet/volumemanager/cache pkg/kubelet/volumemanager/cache
pkg/kubelet/volumemanager/populator pkg/kubelet/volumemanager/populator
@ -216,9 +186,6 @@ pkg/quota
pkg/quota/install pkg/quota/install
pkg/registry pkg/registry
pkg/registry/authorization/util pkg/registry/authorization/util
pkg/registry/clusterrole/storage
pkg/registry/clusterrolebinding/storage
pkg/registry/configmap/storage
pkg/registry/core/configmap/storage pkg/registry/core/configmap/storage
pkg/registry/core/endpoint pkg/registry/core/endpoint
pkg/registry/core/node/rest pkg/registry/core/node/rest
@ -227,34 +194,20 @@ pkg/registry/core/rangeallocation
pkg/registry/core/service/ipallocator/controller pkg/registry/core/service/ipallocator/controller
pkg/registry/core/service/ipallocator/storage pkg/registry/core/service/ipallocator/storage
pkg/registry/core/serviceaccount pkg/registry/core/serviceaccount
pkg/registry/endpoint
pkg/registry/extensions/podsecuritypolicy/storage pkg/registry/extensions/podsecuritypolicy/storage
pkg/registry/extensions/thirdpartyresource pkg/registry/extensions/thirdpartyresource
pkg/registry/extensions/thirdpartyresource/storage 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/clusterrole/storage
pkg/registry/rbac/clusterrolebinding/storage pkg/registry/rbac/clusterrolebinding/storage
pkg/registry/rbac/role/storage pkg/registry/rbac/role/storage
pkg/registry/rbac/rolebinding/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
pkg/runtime/serializer pkg/runtime/serializer
pkg/runtime/serializer/json pkg/runtime/serializer/json
pkg/runtime/serializer/protobuf pkg/runtime/serializer/protobuf
pkg/runtime/serializer/recognizer pkg/runtime/serializer/recognizer
pkg/runtime/serializer/recognizer/testing
pkg/runtime/serializer/streaming pkg/runtime/serializer/streaming
pkg/runtime/serializer/versioning pkg/runtime/serializer/versioning
pkg/runtime/serializer/yaml
pkg/security pkg/security
pkg/security/podsecuritypolicy/apparmor pkg/security/podsecuritypolicy/apparmor
pkg/security/podsecuritypolicy/capabilities pkg/security/podsecuritypolicy/capabilities
@ -265,15 +218,11 @@ pkg/storage/etcd3
pkg/storage/storagebackend/factory pkg/storage/storagebackend/factory
pkg/types pkg/types
pkg/util/async pkg/util/async
pkg/util/cert
pkg/util/codeinspector
pkg/util/errors pkg/util/errors
pkg/util/flock pkg/util/flock
pkg/util/flushwriter
pkg/util/framer pkg/util/framer
pkg/util/goroutinemap pkg/util/goroutinemap
pkg/util/hash pkg/util/hash
pkg/util/homedir
pkg/util/i18n pkg/util/i18n
pkg/util/interrupt pkg/util/interrupt
pkg/util/io pkg/util/io
@ -285,9 +234,6 @@ pkg/util/metrics
pkg/util/net pkg/util/net
pkg/util/netsh pkg/util/netsh
pkg/util/rand pkg/util/rand
pkg/util/ratelimit
pkg/util/replicaset
pkg/util/restoptions
pkg/util/runtime pkg/util/runtime
pkg/util/sets pkg/util/sets
pkg/util/tail pkg/util/tail
@ -324,14 +270,34 @@ plugin/pkg/auth/authenticator
plugin/pkg/auth/authenticator/password plugin/pkg/auth/authenticator/password
plugin/pkg/auth/authenticator/password/allow plugin/pkg/auth/authenticator/password/allow
plugin/pkg/auth/authenticator/request/basicauth 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
plugin/pkg/auth/authorizer/rbac/bootstrappolicy plugin/pkg/auth/authorizer/rbac/bootstrappolicy
plugin/pkg/client/auth staging/src/k8s.io/apimachinery/pkg/api/errors
plugin/pkg/client/auth/gcp staging/src/k8s.io/apimachinery/pkg/apimachinery
test/e2e/cleanup staging/src/k8s.io/apimachinery/pkg/conversion/queryparams
test/e2e/generated 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/perftype
test/e2e_node/runner/local test/e2e_node/runner/local
test/images/clusterapi-tester test/images/clusterapi-tester
@ -355,4 +321,3 @@ test/integration/objectmeta
test/integration/openshift test/integration/openshift
test/soak/cauldron test/soak/cauldron
test/soak/serve_hostnames test/soak/serve_hostnames
third_party/forked/golang/expansion

View File

@ -55,7 +55,7 @@ export IFS=$'\n'
# as the prefix, however if we run it outside it returns the full path of the file # 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. # with a leading underscore. We'll need to support both scenarios for all_packages.
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=( linted_packages=(
$(cat $linted_file) $(cat $linted_file)
@ -76,6 +76,12 @@ for p in "${all_packages[@]}"; do
fi fi
done 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. # Check to be sure all the packages that should pass lint are.
if [ ${#errors[@]} -eq 0 ]; then if [ ${#errors[@]} -eq 0 ]; then
echo 'Congratulations! All Go source files have been linted.' echo 'Congratulations! All Go source files have been linted.'
@ -94,10 +100,20 @@ fi
# check to make sure all packages that pass lint are in the linted file. # check to make sure all packages that pass lint are in the linted file.
echo 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.' echo 'Success! All packages that should pass lint are listed in the linted file.'
else else
{ {
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 "Some packages passed golint but are not listed in hack/.linted_packages."
echo "Please add them in alphabetical order:" echo "Please add them in alphabetical order:"
echo echo
@ -106,6 +122,7 @@ else
done done
echo " LC_ALL=C sort -o hack/.linted_packages hack/.linted_packages" echo " LC_ALL=C sort -o hack/.linted_packages hack/.linted_packages"
echo echo
fi
echo 'You can test via this script and commit the result.' echo 'You can test via this script and commit the result.'
echo echo
} >&2 } >&2