Merge pull request #78232 from SataQiu/fix-golint-20190523

Fix golint failures of pkg/controller/namespace/deletion pkg/controller/serviceaccount
k3s-v1.15.3
Kubernetes Prow Robot 2019-05-29 00:53:02 -07:00 committed by GitHub
commit 501092c7d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 5 deletions

View File

@ -70,7 +70,6 @@ pkg/controller/job
pkg/controller/job/config/v1alpha1
pkg/controller/namespace
pkg/controller/namespace/config/v1alpha1
pkg/controller/namespace/deletion
pkg/controller/nodeipam/config/v1alpha1
pkg/controller/nodelifecycle/config/v1alpha1
pkg/controller/podautoscaler
@ -87,7 +86,6 @@ pkg/controller/resourcequota/config/v1alpha1
pkg/controller/route
pkg/controller/service
pkg/controller/service/config/v1alpha1
pkg/controller/serviceaccount
pkg/controller/serviceaccount/config/v1alpha1
pkg/controller/statefulset
pkg/controller/ttl

View File

@ -37,11 +37,12 @@ import (
v1clientset "k8s.io/client-go/kubernetes/typed/core/v1"
)
// Interface to delete a namespace with all resources in it.
// NamespacedResourcesDeleterInterface is the interface to delete a namespace with all resources in it.
type NamespacedResourcesDeleterInterface interface {
Delete(nsName string) error
}
// NewNamespacedResourcesDeleter returns a new NamespacedResourcesDeleter.
func NewNamespacedResourcesDeleter(nsClient v1clientset.NamespaceInterface,
dynamicClient dynamic.Interface, podsGetter v1clientset.PodsGetter,
discoverResourcesFn func() ([]*metav1.APIResourceList, error),

View File

@ -213,7 +213,7 @@ func TestRetryOnConflictError(t *testing.T) {
retryOnce := func(namespace *v1.Namespace) (*v1.Namespace, error) {
numTries++
if numTries <= 1 {
return namespace, errors.NewConflict(api.Resource("namespaces"), namespace.Name, fmt.Errorf("ERROR!"))
return namespace, errors.NewConflict(api.Resource("namespaces"), namespace.Name, fmt.Errorf("ERROR"))
}
return namespace, nil
}

View File

@ -52,6 +52,7 @@ type ServiceAccountsControllerOptions struct {
NamespaceResync time.Duration
}
// DefaultServiceAccountsControllerOptions returns the default options for creating a ServiceAccountsController.
func DefaultServiceAccountsControllerOptions() ServiceAccountsControllerOptions {
return ServiceAccountsControllerOptions{
ServiceAccounts: []v1.ServiceAccount{
@ -108,6 +109,7 @@ type ServiceAccountsController struct {
queue workqueue.RateLimitingInterface
}
// Run runs the ServiceAccountsController blocks until receiving signal from stopCh.
func (c *ServiceAccountsController) Run(workers int, stopCh <-chan struct{}) {
defer utilruntime.HandleCrash()
defer c.queue.ShutDown()

View File

@ -162,7 +162,7 @@ type TokensController struct {
maxRetries int
}
// Runs controller blocks until stopCh is closed
// Run runs controller blocks until stopCh is closed
func (e *TokensController) Run(workers int, stopCh <-chan struct{}) {
// Shut down queues
defer utilruntime.HandleCrash()