From 32a49438f990c849e7fb97718f1046774672fdfb Mon Sep 17 00:00:00 2001 From: Ruaan <ruaan@uafrica.com> Date: Thu, 28 Apr 2022 12:34:31 +0200 Subject: [PATCH] Fix bug with audit logger --- audit/audit.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/audit/audit.go b/audit/audit.go index 6dff2b1..f4cab13 100644 --- a/audit/audit.go +++ b/audit/audit.go @@ -2,13 +2,14 @@ package audit import ( "encoding/json" - "github.com/r3labs/diff/v2" - "gitlab.com/uafrica/go-utils/reflection" - "gitlab.com/uafrica/go-utils/string_utils" "reflect" "regexp" "strconv" "strings" + + "github.com/r3labs/diff/v2" + "gitlab.com/uafrica/go-utils/reflection" + "gitlab.com/uafrica/go-utils/string_utils" ) type FieldChange struct { @@ -213,7 +214,7 @@ func GetAllChanges(original interface{}, new interface{}) (map[string]interface{ opener := changesJson[index+len(split)+2 : index+len(split)+3] // Prevent a "base level" key from matching a nested key baseLevel := false - if index >= 1 { + if index > 1 { containedBy := changesJson[index-1 : index] if levelsDeep == 0 && (containedBy == "{" || containedBy == "[") { baseLevel = true -- GitLab