pkgtool

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

README

go-pkgtool

A tool for aiding in the creation of generators.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FunInfo

type FunInfo struct {
	FullPath string
	Filename string
	Package  string
	Name     string
	Exported bool
	Params   []byte
	Results  []byte
}

type Package

type Package struct {
	Info         *build.Package
	TokenFileSet *token.FileSet
	Ast          map[string]*ast.File

	// objects get indexed by map[object_name]file_name
	Bads map[string]string // for error handling
	Pkgs map[string]string // package
	Cons map[string]string // constant
	Typs map[string]string // type
	Vars map[string]string // variable
	Funs map[string]string // function or method
	Lbls map[string]string // label
	// contains filtered or unexported fields
}

something to hold the source data in

func GetPackage

func GetPackage(dir string) (*Package, error)

gather package information

func (*Package) Copy

func (p *Package) Copy(src string, dest string) error

copy source to path

func (*Package) Generate

func (p *Package) Generate(dest string, data interface{}, tplSource string) error

func (*Package) GetFun

func (p *Package) GetFun(name string) *FunInfo

func (*Package) GetPackageName

func (p *Package) GetPackageName(filename string) string

find the package name for a file

func (*Package) Init

func (p *Package) Init() *Package

sets initial values

func (*Package) ParseFile

func (p *Package) ParseFile(path string) error

parses file and adds it info to the package

func (*Package) Rename

func (p *Package) Rename(old_name string, new_name string)

changes the package name across the package

func (*Package) ResolvePath

func (p *Package) ResolvePath(path string) (string, string)

Jump to

Keyboard shortcuts

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