From e803de10041b7ee35b6ba80a9e2d86c99946a540 Mon Sep 17 00:00:00 2001 From: Cyrille Nofficial Date: Tue, 28 Jan 2020 23:30:38 +0100 Subject: [PATCH] Reformat code --- camera/camera.go | 6 +++--- camera/camera_test.go | 9 ++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/camera/camera.go b/camera/camera.go index 79a61d3..c64e876 100644 --- a/camera/camera.go +++ b/camera/camera.go @@ -94,10 +94,10 @@ func (o *OpencvCameraPart) publishFrame(tickerTime time.Time) { msg := &events.FrameMessage{ Id: &events.FrameRef{ Name: "camera", - Id: fmt.Sprintf("%d%000d", tickerTime.Unix(), tickerTime.Nanosecond() / 1000 / 1000), + Id: fmt.Sprintf("%d%000d", tickerTime.Unix(), tickerTime.Nanosecond()/1000/1000), CreatedAt: ×tamp.Timestamp{ - Seconds: tickerTime.Unix(), - Nanos: int32(tickerTime.Nanosecond()), + Seconds: tickerTime.Unix(), + Nanos: int32(tickerTime.Nanosecond()), }, }, Frame: img, diff --git a/camera/camera_test.go b/camera/camera_test.go index 207d578..806d1b0 100644 --- a/camera/camera_test.go +++ b/camera/camera_test.go @@ -30,14 +30,14 @@ func (f fakeVideoSource) Read(dest *gocv.Mat) bool { return true } - func TestOpencvCameraPart(t *testing.T) { var muPubEvents sync.Mutex publishedEvents := make(map[string]*[]byte) oldPublish := publish defer func() { - publish = oldPublish}() - publish = func(_ mqtt.Client, topic string, payload *[]byte){ + publish = oldPublish + }() + publish = func(_ mqtt.Client, topic string, payload *[]byte) { muPubEvents.Lock() defer muPubEvents.Unlock() publishedEvents[topic] = payload @@ -47,14 +47,13 @@ func TestOpencvCameraPart(t *testing.T) { imgBuffer := gocv.NewMat() part := OpencvCameraPart{ - client: nil, + client: nil, vc: fakeVideoSource{}, topic: topic, publishFrequency: 1000, imgBuffered: &imgBuffer, } - go part.Start() time.Sleep(5 * time.Millisecond)