mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 22:46:12 +00:00
Let the caller handle the error
Both logging and returning an error is an antipattern
This commit is contained in:
parent
5648200571
commit
7c2cf5f548
@ -83,7 +83,6 @@ func (g *genClientset) GenerateType(c *generator.Context, t *types.Type, w io.Wr
|
||||
"NewDiscoveryClientForConfigOrDie": c.Universe.Function(types.Name{Package: "k8s.io/client-go/discovery", Name: "NewDiscoveryClientForConfigOrDie"}),
|
||||
"NewDiscoveryClient": c.Universe.Function(types.Name{Package: "k8s.io/client-go/discovery", Name: "NewDiscoveryClient"}),
|
||||
"flowcontrolNewTokenBucketRateLimiter": c.Universe.Function(types.Name{Package: "k8s.io/client-go/util/flowcontrol", Name: "NewTokenBucketRateLimiter"}),
|
||||
"glogErrorf": c.Universe.Function(types.Name{Package: "github.com/golang/glog", Name: "Errorf"}),
|
||||
}
|
||||
sw.Do(clientsetInterface, m)
|
||||
sw.Do(clientsetTemplate, m)
|
||||
@ -163,7 +162,6 @@ $range .allGroups$ cs.$.LowerCaseGroupGoName$$.Version$, err =$.PackageAlias$
|
||||
$end$
|
||||
cs.DiscoveryClient, err = $.NewDiscoveryClientForConfig|raw$(&configShallowCopy)
|
||||
if err!=nil {
|
||||
$.glogErrorf|raw$("failed to create the DiscoveryClient: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
return &cs, nil
|
||||
|
Loading…
Reference in New Issue
Block a user