Skip to content

Commit

Permalink
Golden files: always include JSON-ed string (cont) (#2147)
Browse files Browse the repository at this point in the history
## Changes
Follow up to #2142 which did not actually enabled JSON conversion
because of reversed condition on err.

## Tests
Tested via #2118
  • Loading branch information
denik authored Jan 15, 2025
1 parent 6a7eefa commit cc44e36
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libs/testdiff/golden.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ func (r *ReplacementsContext) Set(old, new string) {
// In that case we cannot rely that json(old) == '"{old}"' and need to add it explicitly.

encodedNew, err := json.Marshal(new)
if err != nil {
if err == nil {
encodedOld, err := json.Marshal(old)
if err != nil {
if err == nil {
r.Repls = append(r.Repls, Replacement{Old: string(encodedOld), New: string(encodedNew)})
}
}
Expand Down

0 comments on commit cc44e36

Please sign in to comment.