Browse code

jsonmessage: pass message to aux callback

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>

Tonis Tiigi authored on 2018/05/15 07:47:50
Showing 1 changed files
... ...
@@ -245,7 +245,7 @@ func (jm *JSONMessage) Display(out io.Writer, termInfo termInfo) error {
245 245
 // DisplayJSONMessagesStream displays a json message stream from `in` to `out`, `isTerminal`
246 246
 // describes if `out` is a terminal. If this is the case, it will print `\n` at the end of
247 247
 // each line and move the cursor while displaying.
248
-func DisplayJSONMessagesStream(in io.Reader, out io.Writer, terminalFd uintptr, isTerminal bool, auxCallback func(*json.RawMessage)) error {
248
+func DisplayJSONMessagesStream(in io.Reader, out io.Writer, terminalFd uintptr, isTerminal bool, auxCallback func(JSONMessage)) error {
249 249
 	var (
250 250
 		dec = json.NewDecoder(in)
251 251
 		ids = make(map[string]int)
... ...
@@ -277,7 +277,7 @@ func DisplayJSONMessagesStream(in io.Reader, out io.Writer, terminalFd uintptr,
277 277
 
278 278
 		if jm.Aux != nil {
279 279
 			if auxCallback != nil {
280
-				auxCallback(jm.Aux)
280
+				auxCallback(jm)
281 281
 			}
282 282
 			continue
283 283
 		}
... ...
@@ -330,6 +330,6 @@ type stream interface {
330 330
 }
331 331
 
332 332
 // DisplayJSONMessagesToStream prints json messages to the output stream
333
-func DisplayJSONMessagesToStream(in io.Reader, stream stream, auxCallback func(*json.RawMessage)) error {
333
+func DisplayJSONMessagesToStream(in io.Reader, stream stream, auxCallback func(JSONMessage)) error {
334 334
 	return DisplayJSONMessagesStream(in, stream, stream.FD(), stream.IsTerminal(), auxCallback)
335 335
 }