Skip to content

Commit

Permalink
load pkg.Source check
Browse files Browse the repository at this point in the history
  • Loading branch information
visualfc committed Jul 27, 2023
1 parent 2bf08fe commit 499b599
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions rtypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,13 @@ func (r *TypesLoader) Import(path string) (*types.Package, error) {
r.Import(dep)
}
if len(pkg.Source) > 0 {
tp, err := r.ctx.addImportFile(pkg.Path, pkg.Name+".go", pkg.Source)
if err != nil {
return nil, err
tp, ok := r.ctx.pkgs[pkg.Path]
if !ok {
var err error
tp, err = r.ctx.addImportFile(pkg.Path, pkg.Name+".go", pkg.Source)
if err != nil {
return nil, err
}
}
if err := tp.Load(); err != nil {
return nil, err
Expand Down

0 comments on commit 499b599

Please sign in to comment.