Skip to content

Commit

Permalink
Fix warning in ToRESTMapper()
Browse files Browse the repository at this point in the history
  • Loading branch information
haf committed Jun 19, 2021
1 parent c2cb93c commit 17c9948
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions utils/kubectl/kubectl.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ func (p *KubeProvider) ToDiscoveryClient() (discovery.CachedDiscoveryInterface,
}

func (p *KubeProvider) ToRESTMapper() (meta.RESTMapper, error) {
discoveryClient, _ := p.ToDiscoveryClient()
if discoveryClient != nil {
mapper := restmapper.NewDeferredDiscoveryRESTMapper(discoveryClient)
expander := restmapper.NewShortcutExpander(mapper, discoveryClient)
return expander, nil
discoveryClient, err := p.ToDiscoveryClient()
if err != nil {
return nil, fmt.Errorf("p.ToDiscoveryClient() failed - no restmapper available")
}

return nil, fmt.Errorf("no restmapper")
mapper := restmapper.NewDeferredDiscoveryRESTMapper(discoveryClient)
expander := restmapper.NewShortcutExpander(mapper, discoveryClient)
return expander, nil
}

const (
Expand Down

0 comments on commit 17c9948

Please sign in to comment.