Skip to content

Commit cdacb5f

Browse files
Add ParsedPackage
1 parent 4403317 commit cdacb5f

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

build/build.go

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -935,11 +935,7 @@ func (s *Session) BuildFiles(filenames []string, pkgObj string, cwd string) erro
935935
//
936936
// Relative paths are interpreted relative to the current working dir.
937937
func (s *Session) BuildImportPath(path string) (*compiler.Archive, error) {
938-
_, parsed, err := s.buildImportPathWithSrcDir(path, "")
939-
if err != nil {
940-
return nil, err
941-
}
942-
return s.CompilePackage(parsed)
938+
return s.ImportResolverFor("")(path)
943939
}
944940

945941
// buildImportPathWithSrcDir builds the package specified by the import path.
@@ -1037,6 +1033,7 @@ func (s *Session) BuildPackage(pkg *PackageData) (*ParsedPackage, error) {
10371033
// Create the parsed package and cache it.
10381034
parsed := &ParsedPackage{
10391035
ImportPath: pkg.ImportPath,
1036+
Dir: pkg.Dir,
10401037
Imports: imports,
10411038
GoFiles: files,
10421039
FSet: fileSet,
@@ -1135,16 +1132,7 @@ func (s *Session) WriteCommandPackage(archive *compiler.Archive, pkgObj string)
11351132
sourceMapFilter.MappingCallback = s.SourceMappingCallback(m)
11361133
}
11371134

1138-
deps, err := compiler.ImportDependencies(archive, func(path string) (*compiler.Archive, error) {
1139-
if archive, ok := s.UpToDateArchives[path]; ok {
1140-
return archive, nil
1141-
}
1142-
_, parsed, err := s.buildImportPathWithSrcDir(path, "")
1143-
if err != nil {
1144-
return nil, err
1145-
}
1146-
return s.CompilePackage(parsed)
1147-
})
1135+
deps, err := compiler.ImportDependencies(archive, s.ImportResolverFor(""))
11481136
if err != nil {
11491137
return err
11501138
}

0 commit comments

Comments
 (0)