diff --git a/structs/convert.go b/structs/convert.go index 78e56e94d..3b585883e 100644 --- a/structs/convert.go +++ b/structs/convert.go @@ -61,7 +61,7 @@ func StructToMap(st any, optFns ...MapOptFunc) (map[string]any, error) { } if obj.Kind() != reflect.Struct { - return mp, errors.New("must be an struct") + return mp, errors.New("must be an struct value") } opt := &MapOptions{TagName: defaultFieldTag} diff --git a/strutil/textutil/var_replacer.go b/strutil/textutil/var_replacer.go index 6d02a8259..7b25cd541 100644 --- a/strutil/textutil/var_replacer.go +++ b/strutil/textutil/var_replacer.go @@ -87,7 +87,7 @@ func (r *VarReplacer) Init() *VarReplacer { if !r.init { r.lLen, r.rLen = len(r.Left), len(r.Right) if r.Right != "" { - r.varReg = regexp.MustCompile(regexp.QuoteMeta(r.Left) + `([\w\s.-|]+)` + regexp.QuoteMeta(r.Right)) + r.varReg = regexp.MustCompile(regexp.QuoteMeta(r.Left) + `([\w\s\|.-]+)` + regexp.QuoteMeta(r.Right)) } else { // no right tag. eg: $name, $user.age r.varReg = regexp.MustCompile(regexp.QuoteMeta(r.Left) + `(\w[\w-]*(?:\.[\w-]+)*)`)