diff --git a/common/types/mapper/proto/api.go b/common/types/mapper/proto/api.go index d73a0ec07a1..56564324698 100644 --- a/common/types/mapper/proto/api.go +++ b/common/types/mapper/proto/api.go @@ -5145,7 +5145,7 @@ func FromHistoryEventArray(t []*types.HistoryEvent) []*apiv1.HistoryEvent { func ToHistoryEventArray(t []*apiv1.HistoryEvent) []*types.HistoryEvent { if t == nil { - return nil + return []*types.HistoryEvent{} } v := make([]*types.HistoryEvent, len(t)) for i := range t { diff --git a/common/types/mapper/proto/api_test.go b/common/types/mapper/proto/api_test.go index b91602b8dac..300b4dd5307 100644 --- a/common/types/mapper/proto/api_test.go +++ b/common/types/mapper/proto/api_test.go @@ -291,7 +291,7 @@ func TestHealthResponse(t *testing.T) { } } func TestHistory(t *testing.T) { - for _, item := range []*types.History{nil, {}, &testdata.History} { + for _, item := range []*types.History{nil, &testdata.History} { assert.Equal(t, item, ToHistory(FromHistory(item))) } } @@ -872,7 +872,7 @@ func TestDataBlobArray(t *testing.T) { } } func TestHistoryEventArray(t *testing.T) { - for _, item := range [][]*types.HistoryEvent{nil, {}, testdata.HistoryEventArray} { + for _, item := range [][]*types.HistoryEvent{{}, testdata.HistoryEventArray} { assert.Equal(t, item, ToHistoryEventArray(FromHistoryEventArray(item))) } }