Merge pull request #515 from fate-grand-order/branch
Use errors.New() directly to output the error message
This commit is contained in:
commit
89f62d4fae
8 changed files with 13 additions and 12 deletions
|
@ -2,7 +2,7 @@ package main
|
|||
|
||||
import (
|
||||
gocontext "context"
|
||||
"fmt"
|
||||
"errors"
|
||||
|
||||
"github.com/docker/containerd/api/execution"
|
||||
"github.com/urfave/cli"
|
||||
|
@ -26,7 +26,7 @@ var deleteCommand = cli.Command{
|
|||
|
||||
id := context.Args().First()
|
||||
if id == "" {
|
||||
return fmt.Errorf("container id must be provided")
|
||||
return errors.New("container id must be provided")
|
||||
}
|
||||
|
||||
pid := uint32(context.Int64("pid"))
|
||||
|
|
|
@ -2,7 +2,7 @@ package main
|
|||
|
||||
import (
|
||||
gocontext "context"
|
||||
"fmt"
|
||||
"errors"
|
||||
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/docker/containerd/api/execution"
|
||||
|
@ -20,7 +20,7 @@ var inspectCommand = cli.Command{
|
|||
}
|
||||
id := context.Args().First()
|
||||
if id == "" {
|
||||
return fmt.Errorf("container id must be provided")
|
||||
return errors.New("container id must be provided")
|
||||
}
|
||||
getResponse, err := executionService.GetContainer(gocontext.Background(),
|
||||
&execution.GetContainerRequest{ID: id})
|
||||
|
|
|
@ -22,7 +22,7 @@ var listCommand = cli.Command{
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("ID\tSTATUS\tPROCS\tBUNDLE\n")
|
||||
fmt.Println("ID\tSTATUS\tPROCS\tBUNDLE")
|
||||
for _, c := range listResponse.Containers {
|
||||
listProcResponse, err := executionService.ListProcesses(gocontext.Background(),
|
||||
&execution.ListProcessesRequest{ContainerID: c.ID})
|
||||
|
|
|
@ -20,6 +20,7 @@ import (
|
|||
"github.com/crosbymichael/console"
|
||||
"github.com/docker/containerd/api/shim"
|
||||
"github.com/urfave/cli"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
var fifoFlags = []cli.Flag{
|
||||
|
@ -75,7 +76,7 @@ var shimCreateCommand = cli.Command{
|
|||
Action: func(context *cli.Context) error {
|
||||
id := context.Args().First()
|
||||
if id == "" {
|
||||
return fmt.Errorf("container id must be provided")
|
||||
return errors.New("container id must be provided")
|
||||
}
|
||||
service, err := getShimService()
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue