use MarshalOptions in subscribe cmd (poll)
@@ -123,6 +123,10 @@ var subscribeCmd = &cobra.Command{
}
waitChan := make(chan struct{}, 1)
waitChan <- struct{}{}
+ mo := &collector.MarshalOptions{
+ Multiline: true,
+ Indent: " ",
+ Format: viper.GetString("format")}
go func() {
for {
select {
@@ -157,7 +161,7 @@ var subscribeCmd = &cobra.Command{
waitChan <- struct{}{}
continue
}
- b, err := collector.FormatMsg(nil, response, true, " ")
+ b, err := mo.Marshal(response, nil)
if err != nil {
fmt.Printf("target '%s', subscription '%s': poll response formatting error:%v\n", name, subName, err)
fmt.Println(string(b))
