resolver

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2018 License: MIT Imports: 3 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PackageNotFoundError = errors.New("package not found")

Functions

This section is empty.

Types

type Guess

type Guess map[string]string

Guess is a map of package path -> package name. Names are resolved from this map, and if a name doesn't exist in the map, the package name is guessed from the last part of the path (after the last slash).

func (Guess) ResolvePackage

func (r Guess) ResolvePackage(importPath string) (string, error)

type IdentResolver

type IdentResolver interface {
	ResolveIdent(file *ast.File, parent ast.Node, id *ast.Ident) (string, error)
}

IdentResolver resolves an identifier to a package path. Returns an empty string if the node is not an identifier.

type Map

type Map map[string]string

Map is a map of package path -> package name. Names are resolved from this map, and if a name doesn't exist in the map, an error is returned. Note that Guess is not a NodeResolver, so can't properly resolve identifiers in dot import packages.

func (Map) ResolvePackage

func (r Map) ResolvePackage(importPath string) (string, error)

type PackageResolver

type PackageResolver interface {
	ResolvePackage(path string) (string, error)
}

PackageResolver resolves a package path to a package name.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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