File tree 1 file changed +22
-24
lines changed
1 file changed +22
-24
lines changed Original file line number Diff line number Diff line change @@ -42,38 +42,36 @@ var Command = cli.Command{
42
42
defer cancel ()
43
43
eventsClient := client .EventService ()
44
44
eventsCh , errCh := eventsClient .Subscribe (ctx , context .Args ()... )
45
- for {
45
+ open := true
46
+ for open {
46
47
var e * events.Envelope
47
48
select {
48
- case evt , closed := <- eventsCh :
49
- if closed {
50
- return nil
51
- }
52
- e = evt
53
- case err := <- errCh :
49
+ case e = <- eventsCh :
50
+ case err , open = <- errCh :
54
51
return err
55
52
}
56
-
57
- var out []byte
58
- if e .Event != nil {
59
- v , err := typeurl .UnmarshalAny (e .Event )
60
- if err != nil {
61
- return err
53
+ if e != nil {
54
+ var out []byte
55
+ if e .Event != nil {
56
+ v , err := typeurl .UnmarshalAny (e .Event )
57
+ if err != nil {
58
+ return err
59
+ }
60
+ out , err = json .Marshal (v )
61
+ if err != nil {
62
+ return err
63
+ }
62
64
}
63
- out , err = json .Marshal (v )
64
- if err != nil {
65
+ if _ , err := fmt .Println (
66
+ e .Timestamp ,
67
+ e .Namespace ,
68
+ e .Topic ,
69
+ string (out ),
70
+ ); err != nil {
65
71
return err
66
72
}
67
73
}
68
-
69
- if _ , err := fmt .Println (
70
- e .Timestamp ,
71
- e .Namespace ,
72
- e .Topic ,
73
- string (out ),
74
- ); err != nil {
75
- return err
76
- }
77
74
}
75
+ return nil
78
76
},
79
77
}
You can’t perform that action at this time.
0 commit comments