浏览代码

Invert the logic to preserve the happy path

Signed-off-by: Ulysses Souza <[email protected]>
Ulysses Souza 5 年之前
父节点
当前提交
933bed5f5d
共有 1 个文件被更改,包括 8 次插入6 次删除
  1. 8 6
      client/client.go

+ 8 - 6
client/client.go

@@ -57,13 +57,15 @@ func New(ctx context.Context) (*Client, error) {
 		return nil, err
 	}
 
-	if ba, ok := b.(containers.ContainerService); ok {
-		return &Client{
-			backendType: contextType,
-			cc:          ba,
-		}, nil
+	ba, ok := b.(containers.ContainerService)
+	if !ok {
+		return nil, errors.New("backend not found")
 	}
-	return nil, errors.New("backend not found")
+	return &Client{
+		backendType: contextType,
+		cc:          ba,
+	}, nil
+
 }
 
 type Client struct {