Skip to content

Commit 4a0c9a2

Browse files
authored
Use json.Marshal to convert interface to []byte and fix the panic (#73)
1 parent c447ded commit 4a0c9a2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

writer/json.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ func treeValue(t tree.Tree) interface{} {
3636
opts := jsondiff.DefaultJSONOptions()
3737
opts.SkipMatches = true
3838

39-
before := t.Value.Change.Before.([]byte)
40-
after := t.Value.Change.After.([]byte)
39+
before, _ := json.Marshal(t.Value.Change.Before)
40+
after, _ := json.Marshal(t.Value.Change.After)
4141
_, str := jsondiff.Compare(before, after, &opts)
4242
diff = make(map[string]interface{})
4343
_ = json.Unmarshal([]byte(str), &diff)

0 commit comments

Comments
 (0)