fix golint issues in core/mapping (#497)

This commit is contained in:
Kevin Wan
2021-02-20 23:18:22 +08:00
committed by GitHub
parent 226513ed60
commit 334ee4213f
8 changed files with 87 additions and 67 deletions

View File

@@ -45,6 +45,7 @@ type (
}
)
// Deref dereferences a type, if pointer type, returns its element type.
func Deref(t reflect.Type) reflect.Type {
if t.Kind() == reflect.Ptr {
t = t.Elem()
@@ -53,6 +54,7 @@ func Deref(t reflect.Type) reflect.Type {
return t
}
// Repr returns the string representation of v.
func Repr(v interface{}) string {
if v == nil {
return ""
@@ -72,6 +74,7 @@ func Repr(v interface{}) string {
return reprOfValue(val)
}
// ValidatePtr validates v if it's a valid pointer.
func ValidatePtr(v *reflect.Value) error {
// sequence is very important, IsNil must be called after checking Kind() with reflect.Ptr,
// panic otherwise