service/dap,service/debugger: refactor regexp funcs

Use regex.MatchString and regex.MustCompile.
This commit is contained in:
Oleksandr Redko
2023-04-28 16:49:07 +03:00
committed by Alessandro Arzilli
parent 25f0e7712e
commit 5f588d8927
2 changed files with 7 additions and 7 deletions

View File

@ -1395,7 +1395,7 @@ func (d *Debugger) Sources(filter string) ([]string, error) {
t := proc.ValidTargets{Group: d.target}
for t.Next() {
for _, f := range t.BinInfo().Sources {
if regex.Match([]byte(f)) {
if regex.MatchString(f) {
files = append(files, f)
}
}
@ -1464,7 +1464,7 @@ func (d *Debugger) Types(filter string) ([]string, error) {
}
for _, typ := range types {
if regex.Match([]byte(typ)) {
if regex.MatchString(typ) {
r = append(r, typ)
}
}
@ -1497,7 +1497,7 @@ func (d *Debugger) PackageVariables(filter string, cfg proc.LoadConfig) ([]*proc
}
pvr := pv[:0]
for i := range pv {
if regex.Match([]byte(pv[i].Name)) {
if regex.MatchString(pv[i].Name) {
pvr = append(pvr, pv[i])
}
}