From 44eb07280958e47292c3a34a870c693b16ab5f2b Mon Sep 17 00:00:00 2001 From: Andrew Hobson Date: Tue, 5 Jul 2022 17:15:47 -0400 Subject: [PATCH] Sort added/removed db rows for stability --- db.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/db.go b/db.go index 7fd4e01..dc83ed2 100644 --- a/db.go +++ b/db.go @@ -172,6 +172,7 @@ func buildFormattedDbBaseline(pgInsUpDel pgStatUserTableInsUpdDel, removedRows []string, addedRows []string) (formattedDbBaseline, error) { removedRowsJSON := make([]interface{}, len(removedRows)) addedRowsJSON := make([]interface{}, len(addedRows)) + sort.Strings(removedRows) for i := range removedRows { var v interface{} err := json.Unmarshal([]byte(removedRows[i]), &v) @@ -180,6 +181,7 @@ func buildFormattedDbBaseline(pgInsUpDel pgStatUserTableInsUpdDel, } removedRowsJSON[i] = v } + sort.Strings(addedRows) for i := range addedRows { var v interface{} err := json.Unmarshal([]byte(addedRows[i]), &v)