Skip to content

Commit

Permalink
fix: add check for <autogenerated>
Browse files Browse the repository at this point in the history
  • Loading branch information
Zxilly committed Jan 30, 2024
1 parent 9f79701 commit 41e58e2
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions file.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,6 @@ func (f *GoFile) enumPackages() error {
}

p.Methods = append(p.Methods, m)

if !ok && needFilepath {
fp, _, _ := tab.PCToLine(m.Offset)
p.Filepath = path.Dir(fp)
}
} else {
f := &Function{
Name: n.BaseName(),
Expand All @@ -271,9 +266,13 @@ func (f *GoFile) enumPackages() error {
PackageName: n.PackageName(),
}
p.Functions = append(p.Functions, f)
}

if !ok && needFilepath {
fp, _, _ := tab.PCToLine(f.Offset)
if needFilepath {
fp, _, _ := tab.PCToLine(n.Entry)
if fp == "<autogenerated>" {
p.Filepath = fp
} else {
p.Filepath = path.Dir(fp)
}
}
Expand Down

0 comments on commit 41e58e2

Please sign in to comment.