feat: update skip and need

This commit is contained in:
liruichen 2023-08-25 16:49:07 +08:00
parent 8ea7920fbb
commit b2f4eefd45

View File

@ -324,10 +324,7 @@ func filterProfileByPattern(skippattern []string, needpattern []string, profiles
var out = make([]*cover.Profile, 0)
if len(skippattern) == 0 {
goto need
}
if len(skippattern) != 0 {
for _, profile := range profiles {
skip := false
for _, pattern := range skippattern {
@ -341,11 +338,10 @@ func filterProfileByPattern(skippattern []string, needpattern []string, profiles
out = append(out, profile)
}
}
need:
if len(needpattern) == 0 {
return profiles
}
for _, profile := range profiles {
if len(needpattern) != 0 {
for _, profile := range out {
need := false
for _, pattern := range needpattern {
if strings.Contains(profile.FileName, pattern) {
@ -357,6 +353,7 @@ need:
out = append(out, profile)
}
}
}
return out
}