Переглянути джерело

etcdctlv3/command: watch command to receive events slice

Gyu-Ho Lee 10 роки тому
батько
коміт
37b643b11d
1 змінених файлів з 4 додано та 1 видалено
  1. 4 1
      etcdctlv3/command/watch_command.go

+ 4 - 1
etcdctlv3/command/watch_command.go

@@ -98,6 +98,9 @@ func recvLoop(wStream pb.Watch_WatchClient) {
 		if err != nil {
 			ExitWithError(ExitError, err)
 		}
-		fmt.Printf("%s: %s %s\n", resp.Event.Type, string(resp.Event.Kv.Key), string(resp.Event.Kv.Value))
+		evs := resp.Events
+		for _, ev := range evs {
+			fmt.Printf("%s: %s %s\n", ev.Type, string(ev.Kv.Key), string(ev.Kv.Value))
+		}
 	}
 }