Skip to content

Commit 2d13b4d

Browse files
authored
perf: replace json.NewDecoder with json.Unmarshal in the om package (#867)
1 parent 440c5e0 commit 2d13b4d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

om/json.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func (r *JSONRepository[T]) FetchCache(ctx context.Context, id string, ttl time.
6767

6868
func (r *JSONRepository[T]) decode(record string) (*T, error) {
6969
var v T
70-
if err := json.NewDecoder(strings.NewReader(record)).Decode(&v); err != nil {
70+
if err := json.Unmarshal([]byte(record), &v); err != nil {
7171
return nil, err
7272
}
7373
return &v, nil

0 commit comments

Comments
 (0)