@@ -1018,7 +1018,7 @@ func (s *Session) BuildPackage(pkg *PackageData) (*compiler.Archive, error) {
10181018
10191019 importContext := & compiler.ImportContext {
10201020 Packages : s .Types ,
1021- Import : s .ImportResolverFor (pkg ),
1021+ Import : s .ImportResolverFor (pkg . Dir ),
10221022 }
10231023 archive , err := compiler .Compile (pkg .ImportPath , files , fileSet , importContext , s .options .Minify )
10241024 if err != nil {
@@ -1043,12 +1043,12 @@ func (s *Session) BuildPackage(pkg *PackageData) (*compiler.Archive, error) {
10431043
10441044// ImportResolverFor returns a function which returns a compiled package archive
10451045// given an import path.
1046- func (s * Session ) ImportResolverFor (pkg * PackageData ) func (string ) (* compiler.Archive , error ) {
1046+ func (s * Session ) ImportResolverFor (srcDir string ) func (string ) (* compiler.Archive , error ) {
10471047 return func (path string ) (* compiler.Archive , error ) {
10481048 if archive , ok := s .UpToDateArchives [path ]; ok {
10491049 return archive , nil
10501050 }
1051- _ , archive , err := s .buildImportPathWithSrcDir (path , pkg . Dir )
1051+ _ , archive , err := s .buildImportPathWithSrcDir (path , srcDir )
10521052 return archive , err
10531053 }
10541054}
@@ -1087,13 +1087,7 @@ func (s *Session) WriteCommandPackage(archive *compiler.Archive, pkgObj string)
10871087 sourceMapFilter .MappingCallback = s .SourceMappingCallback (m )
10881088 }
10891089
1090- deps , err := compiler .ImportDependencies (archive , func (path string ) (* compiler.Archive , error ) {
1091- if archive , ok := s .UpToDateArchives [path ]; ok {
1092- return archive , nil
1093- }
1094- _ , archive , err := s .buildImportPathWithSrcDir (path , "" )
1095- return archive , err
1096- })
1090+ deps , err := compiler .ImportDependencies (archive , s .ImportResolverFor ("" ))
10971091 if err != nil {
10981092 return err
10991093 }
0 commit comments