Merge pull request #548 from fate-grand-order/fixed
Use errors.New() directly to output the error message
This commit is contained in:
commit
660783cb00
3 changed files with 5 additions and 5 deletions
|
@ -2,7 +2,6 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
|
@ -17,6 +16,7 @@ import (
|
||||||
protobuf "github.com/gogo/protobuf/types"
|
protobuf "github.com/gogo/protobuf/types"
|
||||||
"github.com/opencontainers/runtime-spec/specs-go"
|
"github.com/opencontainers/runtime-spec/specs-go"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
var rwm = "rwm"
|
var rwm = "rwm"
|
||||||
|
@ -175,7 +175,7 @@ var runCommand = cli.Command{
|
||||||
Action: func(context *cli.Context) error {
|
Action: func(context *cli.Context) error {
|
||||||
id := context.String("id")
|
id := context.String("id")
|
||||||
if id == "" {
|
if id == "" {
|
||||||
return fmt.Errorf("container id must be provided")
|
return errors.New("container id must be provided")
|
||||||
}
|
}
|
||||||
|
|
||||||
containers, err := getExecutionService(context)
|
containers, err := getExecutionService(context)
|
||||||
|
|
4
cmd/dist/ingest.go
vendored
4
cmd/dist/ingest.go
vendored
|
@ -2,13 +2,13 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
contextpkg "context"
|
contextpkg "context"
|
||||||
"fmt"
|
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
contentapi "github.com/docker/containerd/api/services/content"
|
contentapi "github.com/docker/containerd/api/services/content"
|
||||||
"github.com/docker/containerd/content"
|
"github.com/docker/containerd/content"
|
||||||
"github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
var ingestCommand = cli.Command{
|
var ingestCommand = cli.Command{
|
||||||
|
@ -48,7 +48,7 @@ var ingestCommand = cli.Command{
|
||||||
}
|
}
|
||||||
|
|
||||||
if ref == "" {
|
if ref == "" {
|
||||||
return fmt.Errorf("must specify a transaction reference")
|
return errors.New("must specify a transaction reference")
|
||||||
}
|
}
|
||||||
|
|
||||||
ingester := content.NewIngesterFromClient(contentapi.NewContentClient(conn))
|
ingester := content.NewIngesterFromClient(contentapi.NewContentClient(conn))
|
||||||
|
|
2
cmd/dist/list.go
vendored
2
cmd/dist/list.go
vendored
|
@ -54,7 +54,7 @@ var listCommand = cli.Command{
|
||||||
tw := tabwriter.NewWriter(os.Stdout, 1, 8, 1, '\t', 0)
|
tw := tabwriter.NewWriter(os.Stdout, 1, 8, 1, '\t', 0)
|
||||||
defer tw.Flush()
|
defer tw.Flush()
|
||||||
|
|
||||||
fmt.Fprintf(tw, "DIGEST\tSIZE\tAGE\n")
|
fmt.Fprintln(tw, "DIGEST\tSIZE\tAGE")
|
||||||
walkFn = func(path string, fi os.FileInfo, dgst digest.Digest) error {
|
walkFn = func(path string, fi os.FileInfo, dgst digest.Digest) error {
|
||||||
fmt.Fprintf(tw, "%s\t%s\t%s\n",
|
fmt.Fprintf(tw, "%s\t%s\t%s\n",
|
||||||
dgst,
|
dgst,
|
||||||
|
|
Loading…
Reference in a new issue