1
0
Fork 0
forked from forgejo/forgejo

Use type switch (#5122)

This commit is contained in:
Oleg Kovalov 2018-10-19 20:54:26 +02:00 committed by techknowlogick
parent a908b29a74
commit 971dccda16
2 changed files with 24 additions and 24 deletions

View file

@ -299,21 +299,21 @@ func TestFileSize(t *testing.T) {
func TestSubtract(t *testing.T) {
toFloat64 := func(n interface{}) float64 {
switch n.(type) {
switch n := n.(type) {
case int:
return float64(n.(int))
return float64(n)
case int8:
return float64(n.(int8))
return float64(n)
case int16:
return float64(n.(int16))
return float64(n)
case int32:
return float64(n.(int32))
return float64(n)
case int64:
return float64(n.(int64))
return float64(n)
case float32:
return float64(n.(float32))
return float64(n)
case float64:
return n.(float64)
return n
default:
return 0.0
}