packages

package
v1.26.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2026 License: Apache-2.0 Imports: 10 Imported by: 5 modules, 9 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListTimes added in v1.15.2

func ListTimes() int

ListTimes returns the number of times of calling `go list`.

Types

type Cache added in v1.15.2

type Cache interface {
	Find(dir, pkgPath string) (f io.ReadCloser, err error)
}

Cache represents a cache for the importer.

type Importer

type Importer struct {
	// contains filtered or unexported fields
}

Importer represents a Go package importer.

func NewImporter

func NewImporter(fset *token.FileSet, workDir ...string) *Importer

NewImporter creates an Importer object that meets types.ImporterFrom and types.Importer interface.

func (*Importer) Cache added in v1.15.2

func (p *Importer) Cache() Cache

Cache returns the cache of the importer.

func (*Importer) Import

func (p *Importer) Import(pkgPath string) (pkg *types.Package, err error)

Import returns the imported package for the given import path.

func (*Importer) ImportFrom

func (p *Importer) ImportFrom(pkgPath, dir string, mode types.ImportMode) (*types.Package, error)

ImportFrom returns the imported package for the given import path when imported by a package file located in dir. If the import failed, besides returning an error, ImportFrom is encouraged to cache and return a package anyway, if one was created. This will reduce package inconsistencies and follow-on type checker errors due to the missing package. The mode value must be 0; it is reserved for future use. Two calls to ImportFrom with the same path and dir must return the same package.

func (*Importer) SetCache added in v1.15.2

func (p *Importer) SetCache(cache Cache)

SetCache sets an optional cache for the importer.

func (*Importer) SetTags added in v1.16.5

func (p *Importer) SetTags(tags string)

SetTags sets the build tags for the importer.

func (*Importer) Tags added in v1.16.5

func (p *Importer) Tags() string

Tags returns the build tags for the importer.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL