Skip to content

Commit

Permalink
👔 up(text,struct): update some util method, fix text replace error
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Mar 26, 2023
1 parent 721b54a commit a3f173c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion structs/convert.go
Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion strutil/textutil/var_replacer.go
Expand Up @@ -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-]+)*)`)
Expand Down

0 comments on commit a3f173c

Please sign in to comment.