Package gcimporter15 provides various functions for reading gc-generated object files that can be used to implement the Importer interface defined by the Go 1.5 standard library package.
Deprecated: this package will be deleted in October 2017. New code should use golang.org/x/tools/go/gcexportdata.
Internal call graph ▹
Internal call graph ▾
In the call graph viewer below, each node is a function belonging to this package and its children are the functions it calls—perhaps dynamically.
The root nodes are the entry points of the package: functions that may be called from outside the package. There may be non-exported or anonymous functions among them if they are called dynamically from another package.
Click a node to visit that function's source code.
From there you can visit its callers by
clicking its declaring
Functions may be omitted if they were determined to be unreachable in the particular programs or tests that were analyzed.
func BExportData ¶
func BExportData(fset *token.FileSet, pkg *types.Package) byte
BExportData returns binary export data for pkg. If no file set is provided, position info will be missing.
func BImportData ¶
func BImportData(fset *token.FileSet, imports map[string]*types.Package, data byte, path string) (_ int, _ *types.Package, err error)
BImportData imports a package from the serialized package data and returns the number of bytes consumed and a reference to the package. If the export data version is not recognized or the format is otherwise compromised, an error is returned.
func FindExportData ¶
func FindExportData(r *bufio.Reader) (hdr string, err error)
FindExportData positions the reader r at the beginning of the export data section of an underlying GC-created object/archive file by reading from it. The reader must be positioned at the start of the file before calling this function. The hdr result is the string before the export data, either "$$" or "$$B".
func FindPkg(path, srcDir string) (filename, id string)
FindPkg returns the filename and unique package id for an import path based on package information provided by build.Import (using the build.Default build.Context). A relative srcDir is interpreted relative to the current working directory. If no file was found, an empty filename is returned.
func Import(packages map[string]*types.Package, path, srcDir string) (pkg *types.Package, err error)
Import imports a gc-generated package given its import path and srcDir, adds the corresponding package object to the packages map, and returns the object. The packages map must contain all packages already imported.
func ImportData ¶
func ImportData(packages map[string]*types.Package, filename, id string, data io.Reader) (pkg *types.Package, err error)
ImportData imports a package by reading the gc-generated export data, adds the corresponding package object to the packages map indexed by id, and returns the object.
The packages map must contains all packages already imported. The data reader position must be the beginning of the export data section. The filename is only used in error messages.
If packages[id] contains the completely imported package, that package can be used directly, and there is no need to call this function (but there is also no harm but for extra time used).