Browse code

Remove the redundant 'if' statements

Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>

Yanqiang Miao authored on 2017/01/03 12:31:41
Showing 1 changed files
... ...
@@ -101,10 +101,8 @@ func (c *Cluster) RemoveSecret(id string) error {
101 101
 		SecretID: id,
102 102
 	}
103 103
 
104
-	if _, err := state.controlClient.RemoveSecret(ctx, req); err != nil {
105
-		return err
106
-	}
107
-	return nil
104
+	_, err := state.controlClient.RemoveSecret(ctx, req)
105
+	return err
108 106
 }
109 107
 
110 108
 // UpdateSecret updates a secret in a managed swarm cluster.
... ...
@@ -123,16 +121,13 @@ func (c *Cluster) UpdateSecret(id string, version uint64, spec types.SecretSpec)
123 123
 
124 124
 	secretSpec := convert.SecretSpecToGRPC(spec)
125 125
 
126
-	if _, err := state.controlClient.UpdateSecret(ctx,
126
+	_, err := state.controlClient.UpdateSecret(ctx,
127 127
 		&swarmapi.UpdateSecretRequest{
128 128
 			SecretID: id,
129 129
 			SecretVersion: &swarmapi.Version{
130 130
 				Index: version,
131 131
 			},
132 132
 			Spec: &secretSpec,
133
-		}); err != nil {
134
-		return err
135
-	}
136
-
137
-	return nil
133
+		})
134
+	return err
138 135
 }