Let the caller handle the error

Both logging and returning an error is an antipattern
This commit is contained in:
Mikhail Mazurskiy 2018-04-09 19:12:14 +10:00
parent 5648200571
commit 7c2cf5f548
No known key found for this signature in database
GPG Key ID: 93551ECC96E2F568

View File

@ -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