提交 2b0c89a5 作者: Juan Batiz-Benet

commands/diag: switch clarity

上级 76d9d89a
...@@ -106,7 +106,6 @@ connected peers and latencies between them. ...@@ -106,7 +106,6 @@ connected peers and latencies between them.
switch vis { switch vis {
case visD3: case visD3:
res.SetOutput(bytes.NewReader(diag.GetGraphJson(info))) res.SetOutput(bytes.NewReader(diag.GetGraphJson(info)))
return
case visDot: case visDot:
var buf bytes.Buffer var buf bytes.Buffer
w := diag.DotWriter{W: &buf} w := diag.DotWriter{W: &buf}
...@@ -116,15 +115,14 @@ connected peers and latencies between them. ...@@ -116,15 +115,14 @@ connected peers and latencies between them.
return return
} }
res.SetOutput(io.Reader(&buf)) res.SetOutput(io.Reader(&buf))
return default:
} output, err := stdDiagOutputMarshal(standardDiagOutput(info))
if err != nil {
output, err := stdDiagOutputMarshal(standardDiagOutput(info)) res.SetError(err, cmds.ErrNormal)
if err != nil { return
res.SetError(err, cmds.ErrNormal) }
return res.SetOutput(output)
} }
res.SetOutput(output)
}, },
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论