Browse code

client: Client: PluginInstall, PluginUpgrade: remove/rename err-returns

Prevent accidentally shadowing these errors, which are used in defers, and
while at it, also fixed some linting warnings about unhandled errors.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2023/12/28 19:26:09
Showing 1 changed files
... ...
@@ -15,7 +15,7 @@ import (
15 15
 )
16 16
 
17 17
 // PluginInstall installs a plugin
18
-func (cli *Client) PluginInstall(ctx context.Context, name string, options types.PluginInstallOptions) (rc io.ReadCloser, err error) {
18
+func (cli *Client) PluginInstall(ctx context.Context, name string, options types.PluginInstallOptions) (_ io.ReadCloser, retErr error) {
19 19
 	query := url.Values{}
20 20
 	if _, err := reference.ParseNormalizedNamed(options.RemoteRef); err != nil {
21 21
 		return nil, errors.Wrap(err, "invalid remote reference")
... ...
@@ -45,7 +45,7 @@ func (cli *Client) PluginInstall(ctx context.Context, name string, options types
45 45
 			return
46 46
 		}
47 47
 		defer func() {
48
-			if err != nil {
48
+			if retErr != nil {
49 49
 				delResp, _ := cli.delete(ctx, "/plugins/"+name, nil, nil)
50 50
 				ensureReaderClosed(delResp)
51 51
 			}