Skip to content

Commit e61b175

Browse files
welkeyeverAsterDY
authored andcommitted
fix: redundant parse & wrong return time (cloudwego#2)
1 parent f92a46b commit e61b175

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/compress/golang/plugin/go_ast.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,12 @@ func getGoFilesInDir(dir string) []string {
161161
}
162162

163163
func (p *goParser) ParseDir(dir string) ([]Function, bool) {
164+
// unify dir ./xxx/xxx -> xxx/xxx
165+
relativePrefix := "./"
166+
if strings.HasPrefix(dir, relativePrefix) {
167+
dir = strings.TrimPrefix(dir, relativePrefix)
168+
}
169+
164170
if p.processedPkg[dir] != nil {
165171
return p.processedPkg[dir], false
166172
}
@@ -191,7 +197,7 @@ func (p *goParser) ParseTilTheEnd(startDir string) {
191197
for _, f := range functionList {
192198
for _, fc := range f.FunctionCalls {
193199
if p.processedPkg[fc.PkgDir] != nil {
194-
return
200+
continue
195201
}
196202
p.ParseTilTheEnd(fc.PkgDir)
197203
}

0 commit comments

Comments
 (0)