return errors directly, less lines of code

Signed-off-by: Josh Dolitsky <josh@dolit.ski>
pull/9782/head
Josh Dolitsky 3 years ago
parent fc98f2e6a3
commit ec84339d44
No known key found for this signature in database
GPG Key ID: B2B93673243A65FB

@ -67,6 +67,5 @@ func (p *Push) Run(chartRef string, remote string) (string, error) {
c.Options = append(c.Options, pusher.WithRegistryClient(p.cfg.RegistryClient))
}
err := c.UploadTo(chartRef, remote)
return out.String(), err
return out.String(), c.UploadTo(chartRef, remote)
}

@ -67,11 +67,11 @@ func (pusher *OCIPusher) push(chartRef, href string) error {
var pushOpts []registry.PushOption
provRef := fmt.Sprintf("%s.prov", chartRef)
if _, err := os.Stat(provRef); err == nil {
provBytes, err := ioutil.ReadFile(provRef)
if err != nil {
if provBytes, err := ioutil.ReadFile(provRef); err != nil {
if err != os.ErrNotExist { // ignore error if .prov does not exist
return err
}
} else {
pushOpts = append(pushOpts, registry.PushOptProvData(provBytes))
}
@ -80,11 +80,7 @@ func (pusher *OCIPusher) push(chartRef, href string) error {
meta.Metadata.Version)
_, err = client.Push(chartBytes, ref, pushOpts...)
if err != nil {
return err
}
return nil
return err
}
// NewOCIPusher constructs a valid OCI client as a Pusher

Loading…
Cancel
Save