progutils

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func QualifiedIdentifierInfo

func QualifiedIdentifierInfo(se *ast.SelectorExpr, path string, prog *loader.Program) (packagePath, packageName, importAlias, codeAlias string)

QualifiedIdentifierInfo gets info about a package from the SelectorExpr packagePath: the package path of the imported package packageName: the actual name of the imported package importAlias: the alias in the import statement (can be "") codeAlias: the alias used in the code (if importAlias == "", codeAlias == packageName)

Types

type ImportsHelper

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

func NewImportsHelper

func NewImportsHelper(path string, file *ast.File, prog *loader.Program) *ImportsHelper

func (*ImportsHelper) ImportsFromFile

func (ih *ImportsHelper) ImportsFromFile() (map[string]string, error)

func (*ImportsHelper) ImportsFromTree

func (ih *ImportsHelper) ImportsFromTree() (decl *ast.GenDecl, specs map[string]*ast.ImportSpec, imports map[string]string, err error)

func (*ImportsHelper) Refresh

func (ih *ImportsHelper) Refresh(imports map[string]string) error

func (*ImportsHelper) RefreshFromCode

func (ih *ImportsHelper) RefreshFromCode() error

RefreshFromCode scans all the code for SelectorElements

func (*ImportsHelper) RefreshFromFile

func (ih *ImportsHelper) RefreshFromFile() error

func (*ImportsHelper) RegisterImport

func (ih *ImportsHelper) RegisterImport(path string) (name string, err error)

RegisterImport

Jump to

Keyboard shortcuts

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