mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
15 lines
291 B
Go
15 lines
291 B
Go
package dynamic
|
|
|
|
import "reflect"
|
|
|
|
// For backward compatibility of reflect.Value.CanInt in go1.17
|
|
func CanInt(v reflect.Value) bool {
|
|
k := v.Type().Kind()
|
|
switch k {
|
|
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
|
|
return true
|
|
default:
|
|
return false
|
|
}
|
|
}
|