Use named returns for the code style consistency

This commit is contained in:
Nikita Tokarchuk
2020-07-13 03:12:39 +02:00
parent 9cf3551c20
commit 72e74a65b6
23 changed files with 145 additions and 146 deletions
+5 -3
View File
@@ -5,7 +5,7 @@ import (
)
// IsNil function evaluates the interface value to nil
func IsNil(i interface{}) bool {
func IsNil(i interface{}) (isNil bool) {
type iface struct {
_ unsafe.Pointer
@@ -14,8 +14,10 @@ func IsNil(i interface{}) bool {
unpacked := (*iface)(unsafe.Pointer(&i))
if unpacked.ptr == nil {
return true
isNil = true
return
}
return *(*unsafe.Pointer)(unpacked.ptr) == nil
isNil = *(*unsafe.Pointer)(unpacked.ptr) == nil
return
}