pkginfo

package
v0.0.0-...-2d0281a Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2022 License: BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Overview

pkginfo keeps package information of an application for gottani. It also implements types.Importer for parsing files and checking types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PackageInfo

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

PackageInfo represents information of packages used by a applicaion for gottani. It also implements types.Importer for parsing and type-checking.

func New

func New(dir string) (*PackageInfo, error)

New creates PackageInfo with default setting and then Load the given dir

func NewPackageInfo

func NewPackageInfo(fset *token.FileSet, tinfo *types.Info) *PackageInfo

NewPackageInfo creates PackageInfo

func (*PackageInfo) AllPackages

func (ip *PackageInfo) AllPackages() []*build.Package

Packages returns a slice of *build.Packages that are depended by the loaded package.

func (*PackageInfo) FileSet

func (ip *PackageInfo) FileSet() *token.FileSet

FileSet() returns the *token.FileSet that holds all source code for whole the application except standard packages.

func (*PackageInfo) GetAstFiles

func (ip *PackageInfo) GetAstFiles(bp *build.Package) []*ast.File

GetTypesPackage() returns the slice of *ast.File for the package specified by the given bp. It includs Go files and Cgo files.

func (*PackageInfo) GetBuildPackage

func (ip *PackageInfo) GetBuildPackage(importPath, dir string) *build.Package

GetBuildPackage() returns the *build.Package coresponds for the given importPath on the given dir.

func (*PackageInfo) GetTypesPackage

func (ip *PackageInfo) GetTypesPackage(bp *build.Package) *types.Package

GetTypesPackage() returns the *type.Package for the package specified by the given bp.

func (*PackageInfo) Import

func (ip *PackageInfo) Import(path string) (*types.Package, error)

Import imports package specified by the path and returns its type information

func (*PackageInfo) ImportFrom

func (ip *PackageInfo) ImportFrom(path, dir string, mode types.ImportMode) (*types.Package, error)

Import imports package specified by the given path and dir, then returns its type information The mode must be set 0. It is reserved for future use.

func (*PackageInfo) Load

func (ip *PackageInfo) Load(dir string) error

Load loads package information of the application given by the dir

func (*PackageInfo) Packages

func (ip *PackageInfo) Packages() []*build.Package

Packages returns a slice of *build.Packages that are depended by the loaded package and non standard ones.

func (*PackageInfo) Root

func (ip *PackageInfo) Root() *build.Package

Root() returns the package that is in the directory given on Load().

func (*PackageInfo) TypesInfo

func (ip *PackageInfo) TypesInfo() *types.Info

TypesInfo() returns the *types.Info that holds all type information for whole the application.

func (*PackageInfo) WalkPackages

func (ip *PackageInfo) WalkPackages(prune func(*build.Package) bool, pre Walker, post Walker)

WalkPackages travarse packages and do the given pre and/or post function for each package

type Walker

type Walker func(bp *build.Package, tp *types.Package, asts []*ast.File)

Walker is alias to a function type for PackageInfo.WalkPacakge().

Jump to

Keyboard shortcuts

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