Skip to content

Commit

Permalink
Sort added/removed db rows for stability
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Hobson committed Jul 5, 2022
1 parent babe76f commit 44eb072
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 44eb072

Please sign in to comment.