diff options
author | Oleg Kovalov <iamolegkovalov@gmail.com> | 2018-10-19 20:54:26 +0200 |
---|---|---|
committer | techknowlogick <hello@techknowlogick.com> | 2018-10-19 14:54:26 -0400 |
commit | 971dccda16f9541a4b38d3404e0b3e8e7b270490 (patch) | |
tree | 93ba2d3d744dec089abde066ebfe3f31d927fee8 /modules/base/tool_test.go | |
parent | a908b29a74ade0764f2c69b199e5f057abc902b6 (diff) | |
download | gitea-971dccda16f9541a4b38d3404e0b3e8e7b270490.tar.gz gitea-971dccda16f9541a4b38d3404e0b3e8e7b270490.zip |
Use type switch (#5122)
Diffstat (limited to 'modules/base/tool_test.go')
-rw-r--r-- | modules/base/tool_test.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/modules/base/tool_test.go b/modules/base/tool_test.go index f99edd5fbf..04cd682907 100644 --- a/modules/base/tool_test.go +++ b/modules/base/tool_test.go @@ -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 } |