Replace fmt.Errorf() with errors.Errorf() in the cli

Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
Daniel Nephin
2017-03-24 16:58:07 -04:00
parent c1b2fad9aa
commit e9d6193dfd
99 changed files with 370 additions and 337 deletions
+6 -5
View File
@@ -11,6 +11,7 @@ import (
"github.com/docker/docker/cli/internal/test"
"github.com/docker/docker/pkg/testutil/assert"
"github.com/docker/docker/pkg/testutil/golden"
"github.com/pkg/errors"
)
func TestSwarmInitErrorOnAPIFailure(t *testing.T) {
@@ -26,28 +27,28 @@ func TestSwarmInitErrorOnAPIFailure(t *testing.T) {
{
name: "init-failed",
swarmInitFunc: func() (string, error) {
return "", fmt.Errorf("error initializing the swarm")
return "", errors.Errorf("error initializing the swarm")
},
expectedError: "error initializing the swarm",
},
{
name: "init-failed-with-ip-choice",
swarmInitFunc: func() (string, error) {
return "", fmt.Errorf("could not choose an IP address to advertise")
return "", errors.Errorf("could not choose an IP address to advertise")
},
expectedError: "could not choose an IP address to advertise - specify one with --advertise-addr",
},
{
name: "swarm-inspect-after-init-failed",
swarmInspectFunc: func() (swarm.Swarm, error) {
return swarm.Swarm{}, fmt.Errorf("error inspecting the swarm")
return swarm.Swarm{}, errors.Errorf("error inspecting the swarm")
},
expectedError: "error inspecting the swarm",
},
{
name: "node-inspect-after-init-failed",
nodeInspectFunc: func() (swarm.Node, []byte, error) {
return swarm.Node{}, []byte{}, fmt.Errorf("error inspecting the node")
return swarm.Node{}, []byte{}, errors.Errorf("error inspecting the node")
},
expectedError: "error inspecting the node",
},
@@ -57,7 +58,7 @@ func TestSwarmInitErrorOnAPIFailure(t *testing.T) {
flagAutolock: "true",
},
swarmGetUnlockKeyFunc: func() (types.SwarmUnlockKeyResponse, error) {
return types.SwarmUnlockKeyResponse{}, fmt.Errorf("error getting swarm unlock key")
return types.SwarmUnlockKeyResponse{}, errors.Errorf("error getting swarm unlock key")
},
expectedError: "could not fetch unlock key: error getting swarm unlock key",
},