moby/pkg/jsonmessage
Kir Kolyshkin d8f2b47432
TestDisplayJSONMessagesStreamInvalidJSON: fix error check
As pointed out by govet,

> pkg/jsonmessage/jsonmessage_test.go:231:94: nilness: nil dereference in dynamic method call (govet)
> 	if err := DisplayJSONMessagesStream(reader, data, inFd, false, nil); err == nil && err.Error()[:17] != "invalid character" {
>	                                                                                            ^

The nil deref never happened as err was always non-nil, and so the check
for error message text was not performed.

Fix this, and while at it, refactor the code a bit.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2019-09-18 12:57:26 +02:00
..
jsonmessage.go goimports: fix imports 2019-09-18 12:56:54 +02:00
jsonmessage_test.go TestDisplayJSONMessagesStreamInvalidJSON: fix error check 2019-09-18 12:57:26 +02:00