Invert the logic to preserve the happy path

Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
This commit is contained in:
Ulysses Souza 2020-05-01 10:56:46 +02:00
parent 4f3c2c1996
commit 933bed5f5d
1 changed files with 8 additions and 6 deletions

View File

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