mirror of
https://gitee.com/johng/gf.git
synced 2024-11-30 03:07:45 +08:00
fix ci issue
This commit is contained in:
parent
e877eab033
commit
ac78b2fa50
@ -709,7 +709,7 @@ func TestArray_UnmarshalValue(t *testing.T) {
|
||||
"name": "john",
|
||||
"array": []byte(`[1,2,3]`),
|
||||
}, &v)
|
||||
t.Assert(err, nil)
|
||||
t.AssertNil(err)
|
||||
t.Assert(v.Name, "john")
|
||||
t.Assert(v.Array.Slice(), g.Slice{1, 2, 3})
|
||||
})
|
||||
|
@ -59,6 +59,9 @@ func doStructWithJsonCheck(params interface{}, pointer interface{}) (err error,
|
||||
if json.Valid(r) {
|
||||
if rv, ok := pointer.(reflect.Value); ok {
|
||||
if rv.Kind() == reflect.Ptr {
|
||||
if rv.IsNil() {
|
||||
return nil, false
|
||||
}
|
||||
return json.UnmarshalUseNumber(r, rv.Interface()), true
|
||||
} else if rv.CanAddr() {
|
||||
return json.UnmarshalUseNumber(r, rv.Addr().Interface()), true
|
||||
@ -71,6 +74,9 @@ func doStructWithJsonCheck(params interface{}, pointer interface{}) (err error,
|
||||
if paramsBytes := []byte(r); json.Valid(paramsBytes) {
|
||||
if rv, ok := pointer.(reflect.Value); ok {
|
||||
if rv.Kind() == reflect.Ptr {
|
||||
if rv.IsNil() {
|
||||
return nil, false
|
||||
}
|
||||
return json.UnmarshalUseNumber(paramsBytes, rv.Interface()), true
|
||||
} else if rv.CanAddr() {
|
||||
return json.UnmarshalUseNumber(paramsBytes, rv.Addr().Interface()), true
|
||||
|
Loading…
Reference in New Issue
Block a user