diff --git a/structutil/struct.go b/structutil/struct.go index eb053b7..69e1288 100644 --- a/structutil/struct.go +++ b/structutil/struct.go @@ -1,8 +1,9 @@ package structutil import ( - "github.com/duke-git/lancet/v2/pointer" "reflect" + + "github.com/duke-git/lancet/v2/pointer" ) // DefaultTagName is the default tag for struct fields to lookup. @@ -49,7 +50,7 @@ func New(value any) *Struct { // Only the exported fields of a struct can be converted. func (s *Struct) ToMap() (map[string]any, error) { if !s.IsStruct() { - return nil, ErrInvalidStruct(s) + return nil, errInvalidStruct(s) } result := make(map[string]any) diff --git a/structutil/error.go b/structutil/struct_internal.go similarity index 68% rename from structutil/error.go rename to structutil/struct_internal.go index 8b808e1..ada0dd2 100644 --- a/structutil/error.go +++ b/structutil/struct_internal.go @@ -2,6 +2,6 @@ package structutil import "fmt" -func ErrInvalidStruct(v any) error { +func errInvalidStruct(v any) error { return fmt.Errorf("invalid struct %v", v) }