Skip to content

Commit

Permalink
Fix staticchecks in vendor/k8s.io/client-go
Browse files Browse the repository at this point in the history
Kubernetes-commit: 13c017056c924e148113e42786a511ed2fee7594
  • Loading branch information
Git-Jiro authored and k8s-publishing-bot committed Oct 1, 2020
1 parent 5682372 commit 3450a04
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
6 changes: 4 additions & 2 deletions dynamic/fake/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ func (c *dynamicResourceClient) Create(ctx context.Context, obj *unstructured.Un
Invokes(testing.NewRootCreateAction(c.resource, obj), obj)

case len(c.namespace) == 0 && len(subresources) > 0:
accessor, err := meta.Accessor(obj)
var accessor metav1.Object // avoid shadowing err
accessor, err = meta.Accessor(obj)
if err != nil {
return nil, err
}
Expand All @@ -109,7 +110,8 @@ func (c *dynamicResourceClient) Create(ctx context.Context, obj *unstructured.Un
Invokes(testing.NewCreateAction(c.resource, c.namespace, obj), obj)

case len(c.namespace) > 0 && len(subresources) > 0:
accessor, err := meta.Accessor(obj)
var accessor metav1.Object // avoid shadowing err
accessor, err = meta.Accessor(obj)
if err != nil {
return nil, err
}
Expand Down
6 changes: 4 additions & 2 deletions metadata/fake/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ func (c *metadataResourceClient) CreateFake(obj *metav1.PartialObjectMetadata, o
Invokes(testing.NewRootCreateAction(c.resource, obj), obj)

case len(c.namespace) == 0 && len(subresources) > 0:
accessor, err := meta.Accessor(obj)
var accessor metav1.Object // avoid shadowing err
accessor, err = meta.Accessor(obj)
if err != nil {
return nil, err
}
Expand All @@ -127,7 +128,8 @@ func (c *metadataResourceClient) CreateFake(obj *metav1.PartialObjectMetadata, o
Invokes(testing.NewCreateAction(c.resource, c.namespace, obj), obj)

case len(c.namespace) > 0 && len(subresources) > 0:
accessor, err := meta.Accessor(obj)
var accessor metav1.Object // avoid shadowing err
accessor, err = meta.Accessor(obj)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion restmapper/category_expansion.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func NewDiscoveryCategoryExpander(client discovery.DiscoveryInterface) CategoryE
// Expand fulfills CategoryExpander
func (e discoveryCategoryExpander) Expand(category string) ([]schema.GroupResource, bool) {
// Get all supported resources for groups and versions from server, if no resource found, fallback anyway.
apiResourceLists, _ := e.discoveryClient.ServerResources()
_, apiResourceLists, _ := e.discoveryClient.ServerGroupsAndResources()
if len(apiResourceLists) == 0 {
return nil, false
}
Expand Down
2 changes: 1 addition & 1 deletion restmapper/shortcut.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (e shortcutExpander) getShortcutMappings() ([]*metav1.APIResourceList, []re
res := []resourceShortcuts{}
// get server resources
// This can return an error *and* the results it was able to find. We don't need to fail on the error.
apiResList, err := e.discoveryClient.ServerResources()
_, apiResList, err := e.discoveryClient.ServerGroupsAndResources()
if err != nil {
klog.V(1).Infof("Error loading discovery information: %v", err)
}
Expand Down
3 changes: 0 additions & 3 deletions tools/leaderelection/leaderelection.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,6 @@ type LeaderElector struct {
clock clock.Clock

metrics leaderMetricsAdapter

// name is the name of the resource lock for debugging
name string
}

// Run starts the leader election loop. Run will not return
Expand Down

0 comments on commit 3450a04

Please sign in to comment.