Golden files: always include JSON-ed string (cont) (#2147)

## Changes
Follow up to #2142 which did not actually enabled JSON conversion
because of reversed condition on err.

## Tests
Tested via #2118
This commit is contained in:
Denis Bilenko 2025-01-15 09:46:06 +01:00 committed by GitHub
parent 6a7eefa54b
commit cc44e368b8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -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)})
}
}