summaryrefslogtreecommitdiff
path: root/devdocs/go/go%2Fimporter%2Findex.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/go/go%2Fimporter%2Findex.html
new repository
Diffstat (limited to 'devdocs/go/go%2Fimporter%2Findex.html')
-rw-r--r--devdocs/go/go%2Fimporter%2Findex.html22
1 files changed, 22 insertions, 0 deletions
diff --git a/devdocs/go/go%2Fimporter%2Findex.html b/devdocs/go/go%2Fimporter%2Findex.html
new file mode 100644
index 00000000..57e52794
--- /dev/null
+++ b/devdocs/go/go%2Fimporter%2Findex.html
@@ -0,0 +1,22 @@
+<h1> Package importer </h1> <ul id="short-nav">
+<li><code>import "go/importer"</code></li>
+<li><a href="#pkg-overview" class="overviewLink">Overview</a></li>
+<li><a href="#pkg-index" class="indexLink">Index</a></li>
+</ul> <h2 id="pkg-overview">Overview </h2> <p>Package importer provides access to export data importers. </p> <h2 id="pkg-index">Index </h2> <ul id="manual-nav">
+<li><a href="#Default">func Default() types.Importer</a></li>
+<li><a href="#For">func For(compiler string, lookup Lookup) types.Importer</a></li>
+<li><a href="#ForCompiler">func ForCompiler(fset *token.FileSet, compiler string, lookup Lookup) types.Importer</a></li>
+<li><a href="#Lookup">type Lookup</a></li>
+</ul> <h3>Package files</h3> <p> <span>importer.go</span> </p> <h2 id="Default">func <span>Default</span> <span title="Added in Go 1.5">1.5</span> </h2> <pre data-language="go">func Default() types.Importer</pre> <p>Default returns an Importer for the compiler that built the running binary. If available, the result implements <span>types.ImporterFrom</span>. </p>
+<h2 id="For">func <span>For</span> <span title="Added in Go 1.5">1.5</span> </h2> <pre data-language="go">func For(compiler string, lookup Lookup) types.Importer</pre> <p>For calls <a href="#ForCompiler">ForCompiler</a> with a new FileSet. </p>
+<p>Deprecated: Use <a href="#ForCompiler">ForCompiler</a>, which populates a FileSet with the positions of objects created by the importer. </p>
+<h2 id="ForCompiler">func <span>ForCompiler</span> <span title="Added in Go 1.12">1.12</span> </h2> <pre data-language="go">func ForCompiler(fset *token.FileSet, compiler string, lookup Lookup) types.Importer</pre> <p>ForCompiler returns an Importer for importing from installed packages for the compilers "gc" and "gccgo", or for importing directly from the source if the compiler argument is "source". In this latter case, importing may fail under circumstances where the exported API is not entirely defined in pure Go source code (if the package API depends on cgo-defined entities, the type checker won't have access to those). </p>
+<p>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. </p>
+<p>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. </p>
+<h2 id="Lookup">type <span>Lookup</span> <span title="Added in Go 1.5">1.5</span> </h2> <p>A Lookup function returns a reader to access package data for a given import path, or an error if no matching package is found. </p>
+<pre data-language="go">type Lookup func(path string) (io.ReadCloser, error)</pre><div class="_attribution">
+ <p class="_attribution-p">
+ &copy; Google, Inc.<br>Licensed under the Creative Commons Attribution License 3.0.<br>
+ <a href="http://golang.org/pkg/go/importer/" class="_attribution-link">http://golang.org/pkg/go/importer/</a>
+ </p>
+</div>