Skip to content

Commit f547424

Browse files
committed
feat: remove unsafe.Slice in om to support go1.18
1 parent 39cb3b1 commit f547424

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

om/conv.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ package om
33
import (
44
"encoding/json"
55
"fmt"
6+
"github.com/redis/rueidis"
67
"reflect"
78
"strconv"
8-
9-
"github.com/redis/rueidis"
109
)
1110

1211
func newHashConvFactory(t reflect.Type, schema schema) *hashConvFactory {
@@ -68,7 +67,7 @@ func (r hashConv) FromHash(fields map[string]string) error {
6867
continue
6968
}
7069
if f.conv.StringToValue == nil {
71-
if err := json.Unmarshal(unsafe.Slice(unsafe.StringData(v), len(v)), r.entity.Field(f.idx).Addr().Interface()); err != nil {
70+
if err := json.Unmarshal([]byte(v), r.entity.Field(f.idx).Addr().Interface()); err != nil {
7271
return err
7372
}
7473
} else {

0 commit comments

Comments
 (0)