From a07d55492799c759a9e8cbe5c1a7d64e545b0f35 Mon Sep 17 00:00:00 2001 From: wafuwafu13 Date: Sat, 22 Apr 2023 16:47:57 +0100 Subject: [PATCH] fix: check err --- events/ecs_container_instance_test.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/events/ecs_container_instance_test.go b/events/ecs_container_instance_test.go index db8d05e4..e1455051 100644 --- a/events/ecs_container_instance_test.go +++ b/events/ecs_container_instance_test.go @@ -85,7 +85,10 @@ func TestECSContainerInstanceEventMarshaling(t *testing.T) { // `registeredResources` key and `remainingResources` key have `stringSetValue` key. // if `stringSetValue` key is empty array, it should be removed from outputJSON. var result map[string]interface{} - json.Unmarshal(outputJSON, &result) + err = json.Unmarshal(outputJSON, &result) + if err != nil { + t.Errorf("could not marshal event. details: %v", err) + } for _, resourcesType := range []string{"registeredResources", "remainingResources"} { resources := result["detail"].(map[string]interface{})[resourcesType].([]interface{}) for i, resource := range resources { @@ -99,7 +102,10 @@ func TestECSContainerInstanceEventMarshaling(t *testing.T) { } } } - resultJSON, _ := json.Marshal(result) + resultJSON, err := json.Marshal(result) + if err != nil { + t.Errorf("could not marshal event. details: %v", err) + } assert.JSONEq(t, string(outputJSON), string(resultJSON)) }