genutil

package
v0.0.0-...-5e59362 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2019 License: MIT Imports: 16 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllDeclsFromAstPkg

func AllDeclsFromAstPkg(pkg *ast.Package) []ast.Decl

func AstFileToImportMap

func AstFileToImportMap(file *ast.File) map[string]string

func DirToAstWalker

func DirToAstWalker(targetDir string, fileFilter func(finfo os.FileInfo) bool) (map[string]AstPkgWalker, error)

func GoFmtImports

func GoFmtImports(pkgs map[string]string) string

func LocalPathToPackagePath

func LocalPathToPackagePath(s string) (string, error)

func ParseFieldName

func ParseFieldName(field *ast.Field) string

func ToSortedFileListFromFileMapOfAst

func ToSortedFileListFromFileMapOfAst(s map[string]*ast.File) []*ast.File

Types

type AstPkgWalker

type AstPkgWalker struct {
	FileSet *token.FileSet
	Pkg     *ast.Package
	Files   []*ast.File
	Decls   []ast.Decl

	PkgPath string
}

func ParseAstPkg

func ParseAstPkg(fset *token.FileSet, pkg *ast.Package) (AstPkgWalker, error)

func (AstPkgWalker) AllFuncDecls

func (w AstPkgWalker) AllFuncDecls() []*ast.FuncDecl

func (AstPkgWalker) AllGenDecls

func (w AstPkgWalker) AllGenDecls() []*ast.GenDecl

func (AstPkgWalker) AllStructSpecs

func (w AstPkgWalker) AllStructSpecs() []*ast.TypeSpec

func (AstPkgWalker) AllTypeSpecs

func (w AstPkgWalker) AllTypeSpecs() []*ast.TypeSpec

func (AstPkgWalker) FindFuncDecl

func (w AstPkgWalker) FindFuncDecl(filter func(*ast.FuncDecl) bool) *ast.FuncDecl

func (AstPkgWalker) FindTypeSpec

func (w AstPkgWalker) FindTypeSpec(filter func(*ast.TypeSpec) bool) *ast.TypeSpec

func (AstPkgWalker) ToFile

func (w AstPkgWalker) ToFile(node ast.Node) *ast.File

func (AstPkgWalker) ToTypePrinter

func (w AstPkgWalker) ToTypePrinter(typeExpr ast.Expr) (TypePrinter, error)

func (AstPkgWalker) TypeSpecToGenDecl

func (w AstPkgWalker) TypeSpecToGenDecl(spec *ast.TypeSpec) *ast.GenDecl

type TypePrinter

type TypePrinter struct {
	FullString string
}

func ToTypePrinter

func ToTypePrinter(importMap map[string]string, currentPkg string, typ string) (TypePrinter, error)

func (TypePrinter) ImportPkgMap

func (p TypePrinter) ImportPkgMap(currentPkg string) map[string]string

func (TypePrinter) ImportPkgs

func (p TypePrinter) ImportPkgs(currentPkg string) []string

func (TypePrinter) Print

func (p TypePrinter) Print(currentPkg string) string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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