feat: update skip and need +
This commit is contained in:
parent
b2f4eefd45
commit
d1708d550e
@ -323,6 +323,7 @@ func (gs *gocServer) watchProfileUpdate(c *gin.Context) {
|
|||||||
func filterProfileByPattern(skippattern []string, needpattern []string, profiles []*cover.Profile) []*cover.Profile {
|
func filterProfileByPattern(skippattern []string, needpattern []string, profiles []*cover.Profile) []*cover.Profile {
|
||||||
|
|
||||||
var out = make([]*cover.Profile, 0)
|
var out = make([]*cover.Profile, 0)
|
||||||
|
var skipOut = make([]*cover.Profile, 0)
|
||||||
|
|
||||||
if len(skippattern) != 0 {
|
if len(skippattern) != 0 {
|
||||||
for _, profile := range profiles {
|
for _, profile := range profiles {
|
||||||
@ -335,25 +336,28 @@ func filterProfileByPattern(skippattern []string, needpattern []string, profiles
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !skip {
|
if !skip {
|
||||||
out = append(out, profile)
|
skipOut = append(skipOut, profile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
log.Infof("skipOut len: %v", len(skipOut))
|
||||||
|
if len(needpattern) == 0 {
|
||||||
|
return skipOut
|
||||||
|
}
|
||||||
|
|
||||||
if len(needpattern) != 0 {
|
for _, profile := range skipOut {
|
||||||
for _, profile := range out {
|
need := false
|
||||||
need := false
|
for _, pattern := range needpattern {
|
||||||
for _, pattern := range needpattern {
|
if strings.Contains(profile.FileName, pattern) {
|
||||||
if strings.Contains(profile.FileName, pattern) {
|
need = true
|
||||||
need = true
|
break
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if need {
|
|
||||||
out = append(out, profile)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if need {
|
||||||
|
out = append(out, profile)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
log.Infof("need out len: %v", len(out))
|
||||||
|
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user