mirror of
https://github.com/containers/podman.git
synced 2025-12-02 19:28:58 +08:00
fix(deps): update module github.com/crc-org/vfkit to v0.6.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This commit is contained in:
32
vendor/github.com/go-playground/validator/v10/validator.go
generated
vendored
32
vendor/github.com/go-playground/validator/v10/validator.go
generated
vendored
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// per validate construct
|
||||
@@ -156,7 +157,7 @@ func (v *validate) traverseField(ctx context.Context, parent reflect.Value, curr
|
||||
structNs: v.str2,
|
||||
fieldLen: uint8(len(cf.altName)),
|
||||
structfieldLen: uint8(len(cf.name)),
|
||||
value: current.Interface(),
|
||||
value: getValue(current),
|
||||
param: ct.param,
|
||||
kind: kind,
|
||||
typ: current.Type(),
|
||||
@@ -410,7 +411,7 @@ OUTER:
|
||||
structNs: v.str2,
|
||||
fieldLen: uint8(len(cf.altName)),
|
||||
structfieldLen: uint8(len(cf.name)),
|
||||
value: current.Interface(),
|
||||
value: getValue(current),
|
||||
param: ct.param,
|
||||
kind: kind,
|
||||
typ: typ,
|
||||
@@ -430,7 +431,7 @@ OUTER:
|
||||
structNs: v.str2,
|
||||
fieldLen: uint8(len(cf.altName)),
|
||||
structfieldLen: uint8(len(cf.name)),
|
||||
value: current.Interface(),
|
||||
value: getValue(current),
|
||||
param: ct.param,
|
||||
kind: kind,
|
||||
typ: typ,
|
||||
@@ -470,7 +471,7 @@ OUTER:
|
||||
structNs: v.str2,
|
||||
fieldLen: uint8(len(cf.altName)),
|
||||
structfieldLen: uint8(len(cf.name)),
|
||||
value: current.Interface(),
|
||||
value: getValue(current),
|
||||
param: ct.param,
|
||||
kind: kind,
|
||||
typ: typ,
|
||||
@@ -484,3 +485,26 @@ OUTER:
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func getValue(val reflect.Value) interface{} {
|
||||
if val.CanInterface() {
|
||||
return val.Interface()
|
||||
}
|
||||
|
||||
if val.CanAddr() {
|
||||
return reflect.NewAt(val.Type(), unsafe.Pointer(val.UnsafeAddr())).Elem().Interface()
|
||||
}
|
||||
|
||||
switch val.Kind() {
|
||||
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
|
||||
return val.Int()
|
||||
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
|
||||
return val.Uint()
|
||||
case reflect.Complex64, reflect.Complex128:
|
||||
return val.Complex()
|
||||
case reflect.Float32, reflect.Float64:
|
||||
return val.Float()
|
||||
default:
|
||||
return val.String()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user