refactor: clean code
This commit is contained in:
@@ -5,6 +5,8 @@ import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"github.com/usual2970/certimate/internal/pkg/utils/types"
|
||||
)
|
||||
|
||||
// 表示默认的日志记录器类型。
|
||||
@@ -21,7 +23,7 @@ func (l *DefaultLogger) Logt(tag string, data ...any) {
|
||||
temp[0] = tag
|
||||
for i, v := range data {
|
||||
s := ""
|
||||
if v == nil {
|
||||
if types.IsNil(v) {
|
||||
s = "<nil>"
|
||||
} else {
|
||||
switch reflect.ValueOf(v).Kind() {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import "reflect"
|
||||
|
||||
// 判断对象是否为 nil。
|
||||
// 与直接使用 `obj == nil` 不同,该函数会正确判断接口类型对象的真实值是否为空。
|
||||
//
|
||||
// 入参:
|
||||
// - value:待判断的对象。
|
||||
|
||||
Reference in New Issue
Block a user