diff --git a/structs/struct.go b/structs/struct.go index 8c080d2..14207ed 100644 --- a/structs/struct.go +++ b/structs/struct.go @@ -2,6 +2,7 @@ package structs import ( + "fmt" "reflect" "github.com/duke-git/lancet/v2/pointer" @@ -61,7 +62,7 @@ func New(value any, tagName ...string) *Struct { // ToMap convert the exported fields of a struct to map. func (s *Struct) ToMap() (map[string]any, error) { if !s.IsStruct() { - return nil, errInvalidStruct(s) + return nil, fmt.Errorf("invalid struct %v", s) } result := make(map[string]any) diff --git a/structs/struct_internal.go b/structs/struct_internal.go deleted file mode 100644 index bc147cc..0000000 --- a/structs/struct_internal.go +++ /dev/null @@ -1,7 +0,0 @@ -package structs - -import "fmt" - -func errInvalidStruct(v any) error { - return fmt.Errorf("invalid struct %v", v) -}