1
0
mirror of https://github.com/rancher/rke.git synced 2025-07-05 03:28:08 +00:00
rke/vendor/github.com/Masterminds/sprig/v3/reflect.go
2019-11-14 10:54:00 -08:00

29 lines
548 B
Go

package sprig
import (
"fmt"
"reflect"
)
// typeIs returns true if the src is the type named in target.
func typeIs(target string, src interface{}) bool {
return target == typeOf(src)
}
func typeIsLike(target string, src interface{}) bool {
t := typeOf(src)
return target == t || "*"+target == t
}
func typeOf(src interface{}) string {
return fmt.Sprintf("%T", src)
}
func kindIs(target string, src interface{}) bool {
return target == kindOf(src)
}
func kindOf(src interface{}) string {
return reflect.ValueOf(src).Kind().String()
}