瀏覽代碼

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))
+		}
 	}
 }