Skip to content

Commit

Permalink
Merge pull request #252 from goplus/pkgsrc
Browse files Browse the repository at this point in the history
load pkg.Source check
  • Loading branch information
visualfc authored Jul 27, 2023
2 parents 2bf08fe + 499b599 commit 1a2d712
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 1a2d712

Please sign in to comment.