From 0e306e59b87299c33e3b94f4ab590fbabe5e3af7 Mon Sep 17 00:00:00 2001 From: Regis Date: Fri, 25 Nov 2016 17:31:44 +0100 Subject: [PATCH] Cloned actions --- engine/action.go | 9 +++++---- engine/actions_test.go | 8 +++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/engine/action.go b/engine/action.go index e0ec37060..f15c58846 100644 --- a/engine/action.go +++ b/engine/action.go @@ -749,10 +749,11 @@ func (apl Actions) Sort() { sort.Sort(apl) } -func (apl *Actions) Clone() (interface{}, error) { - //cln := new(Actions) - if err := utils.Clone(*apl, cln); err != nil { +func (apl Actions) Clone() (Actions, error) { + + var cln Actions + if err := utils.Clone(apl, &cln); err != nil { return nil, err } - return interface{}(cln), nil + return cln, nil } diff --git a/engine/actions_test.go b/engine/actions_test.go index fa985e4e5..5bd3bc81f 100644 --- a/engine/actions_test.go +++ b/engine/actions_test.go @@ -2338,7 +2338,7 @@ func TestClonedAction(t *testing.T) { } func TestClonedActions(t *testing.T) { - actions := &Actions{ + actions := Actions{ &Action{ Id: "RECUR_FOR_V3HSILLMILLD1G", ActionType: TOPUP, @@ -2367,10 +2367,8 @@ func TestClonedActions(t *testing.T) { t.Error("error cloning actions: ", err) } - clonedActions := clone.(*Actions) - - if !reflect.DeepEqual(actions, clonedActions) { - t.Error("error cloning actions: ", utils.ToIJSON(clonedActions)) + if !reflect.DeepEqual(actions, clone) { + t.Error("error cloning actions: ", utils.ToIJSON(clone)) } }