]> Cypherpunks repositories - gostls13.git/commitdiff
go/importer: update documentation on ForCompiler lookup parameter
authorRobert Griesemer <gri@golang.org>
Thu, 27 Jun 2019 20:17:48 +0000 (13:17 -0700)
committerRobert Griesemer <gri@golang.org>
Thu, 27 Jun 2019 20:43:26 +0000 (20:43 +0000)
Change-Id: I80dff181a79858b52ba77c3f38f77a744b423afa
Reviewed-on: https://go-review.googlesource.com/c/go/+/184079
Reviewed-by: Michael Matloob <matloob@golang.org>
src/go/importer/importer.go

index fbbc3c9017fc8d665b9b1e421d6be50a9ffbcb4f..23118d366e6bc37547c3bfdb880b7bdd0418db85 100644 (file)
@@ -28,17 +28,15 @@ type Lookup func(path string) (io.ReadCloser, error)
 // (if the package API depends on cgo-defined entities, the type
 // checker won't have access to those).
 //
-// If lookup is nil, the default package lookup mechanism for the
-// given compiler is used, and the resulting importer attempts
-// to resolve relative and absolute import paths to canonical
-// import path IDs before finding the imported file.
+// The lookup function is called each time the resulting importer needs
+// to resolve an import path. In this mode the importer can only be
+// invoked with canonical import paths (not relative or absolute ones);
+// it is assumed that the translation to canonical import paths is being
+// done by the client of the importer.
 //
-// If lookup is non-nil, then the returned importer calls lookup
-// each time it needs to resolve an import path. In this mode
-// the importer can only be invoked with canonical import paths
-// (not relative or absolute ones); it is assumed that the translation
-// to canonical import paths is being done by the client of the
-// importer.
+// A lookup function must be provided for correct module-aware operation.
+// Deprecated: If lookup is nil, for backwards-compatibility, the importer
+// will attempt to resolve imports in the $GOPATH workspace.
 func ForCompiler(fset *token.FileSet, compiler string, lookup Lookup) types.Importer {
        switch compiler {
        case "gc":