refactor: moved all fatal errors to logrus

This will allow us to test commands that would normally exit
This commit is contained in:
2021-07-21 09:04:34 +01:00
parent 2158dc851c
commit 29971c36a0
4 changed files with 12 additions and 10 deletions

View File

@ -2,7 +2,6 @@ package client
import (
"errors"
"fmt"
"net/http"
"os"
@ -12,6 +11,7 @@ import (
dCliContextStore "github.com/docker/cli/cli/context/store"
dClient "github.com/docker/docker/client"
"github.com/moby/term"
"github.com/sirupsen/logrus"
)
func NewClientWithContext(contextURL string) *dClient.Client {
@ -44,8 +44,7 @@ func NewClientWithContext(contextURL string) *dClient.Client {
cl, err := dClient.NewClientWithOpts(clientOpts...)
if err != nil {
fmt.Println("Unable to create docker client")
panic(err)
logrus.Fatalf("unable to create Docker client: %s", err)
}
return cl
}