Skip to content

Commit 4403317

Browse files
Add ParsedPackage
1 parent bfda8e2 commit 4403317

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

build/build.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,11 @@ 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-
return s.ImportResolverFor("")(path)
938+
_, parsed, err := s.buildImportPathWithSrcDir(path, "")
939+
if err != nil {
940+
return nil, err
941+
}
942+
return s.CompilePackage(parsed)
939943
}
940944

941945
// buildImportPathWithSrcDir builds the package specified by the import path.
@@ -1131,7 +1135,16 @@ func (s *Session) WriteCommandPackage(archive *compiler.Archive, pkgObj string)
11311135
sourceMapFilter.MappingCallback = s.SourceMappingCallback(m)
11321136
}
11331137

1134-
deps, err := compiler.ImportDependencies(archive, s.ImportResolverFor(""))
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+
})
11351148
if err != nil {
11361149
return err
11371150
}

0 commit comments

Comments
 (0)