@@ -5,6 +5,7 @@ package context
55
66import (
77 "bytes"
8+ "errors"
89 "fmt"
910
1011 cerrdefs "github.com/containerd/errdefs"
@@ -14,7 +15,6 @@ import (
1415 "github.com/docker/cli/cli/command/formatter/tabwriter"
1516 "github.com/docker/cli/cli/context/docker"
1617 "github.com/docker/cli/cli/context/store"
17- "github.com/pkg/errors"
1818 "github.com/spf13/cobra"
1919)
2020
@@ -91,7 +91,7 @@ func createNewContext(contextStore store.ReaderWriter, o *CreateOptions) error {
9191 }
9292 dockerEP , dockerTLS , err := getDockerEndpointMetadataAndTLS (contextStore , o .Docker )
9393 if err != nil {
94- return errors . Wrap ( err , "unable to create docker endpoint config" )
94+ return fmt . Errorf ( "unable to create docker endpoint config: %w" , err )
9595 }
9696 contextMetadata := store.Metadata {
9797 Endpoints : map [string ]any {
@@ -124,9 +124,9 @@ func checkContextNameForCreation(s store.Reader, name string) error {
124124 }
125125 if _ , err := s .GetMetadata (name ); ! cerrdefs .IsNotFound (err ) {
126126 if err != nil {
127- return errors . Wrap ( err , "error while getting existing contexts" )
127+ return fmt . Errorf ( "error while getting existing contexts: %w" , err )
128128 }
129- return errors .Errorf ("context %q already exists" , name )
129+ return fmt .Errorf ("context %q already exists" , name )
130130 }
131131 return nil
132132}
0 commit comments