go vet suggestion

This commit is contained in:
Luke I. Wilson 2023-05-14 08:54:22 -05:00
parent 435ce1e144
commit 9e5239c20a

16
data.go
View File

@ -125,9 +125,9 @@ func (o *DataFrame) Float(column string, i int) float64 {
if val == nil { if val == nil {
return 0 return 0
} }
switch val.(type) { switch val := val.(type) {
case float64: case float64:
return val.(float64) return val
default: default:
return 0 return 0
} }
@ -139,9 +139,9 @@ func (o *DataFrame) Int(column string, i int) int {
if val == nil { if val == nil {
return 0 return 0
} }
switch val.(type) { switch val := val.(type) {
case int: case int:
return val.(int) return val
default: default:
return 0 return 0
} }
@ -153,9 +153,9 @@ func (o *DataFrame) String(column string, i int) string {
if val == nil { if val == nil {
return "" return ""
} }
switch val.(type) { switch val := val.(type) {
case string: case string:
return val.(string) return val
default: default:
return "" return ""
} }
@ -167,9 +167,9 @@ func (o *DataFrame) Time(column string, i int) time.Time {
if val == nil { if val == nil {
return time.Time{} return time.Time{}
} }
switch val.(type) { switch val := val.(type) {
case time.Time: case time.Time:
return val.(time.Time) return val
default: default:
return time.Time{} return time.Time{}
} }