Skip to content

Commit

Permalink
pin command: rename Error field to Errors
Browse files Browse the repository at this point in the history
The commands library interprets the result as an error if it has an Error field.
We're working on fixing this by ensuring that errors are either sent as trailers
or as the body of a non-200 response. However, we've kept the client-side of the
commands library backwards compatible for now.

🦆

License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
  • Loading branch information
Stebalien committed Jan 8, 2019
1 parent 2956bd0 commit d446d58
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/commands/pin.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ var PinCmd = &cmds.Command{
}

type PinOutput struct {
Pins []string
Error map[string]error `json:",omitempty"`
Pins []string
Errors map[string]error `json:",omitempty"`
}

type AddPinOutput struct {
Expand Down Expand Up @@ -252,7 +252,7 @@ collected if needed. (By default, recursively. Use -r=false for direct pins.)
Encoders: cmds.EncoderMap{
cmds.Text: cmds.MakeTypedEncoder(func(req *cmds.Request, w io.Writer, out *PinOutput) error {
for _, k := range out.Pins {
if err, ok := out.Error[k]; !ok {
if err, ok := out.Errors[k]; !ok {
fmt.Fprintf(w, "unpinned %s\n", k)
} else {
fmt.Fprintf(os.Stderr, "cannot unpin %s: %s\n", k, err)
Expand Down

0 comments on commit d446d58

Please sign in to comment.