Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatCode

func FormatCode(source string) string

FormatCode format code

func RegexpReplace

func RegexpReplace(reg, src, temp string) string

RegexpReplace replace regexp

func SourceText

func SourceText() string

SourceText get source file text

Types

type Source

type Source struct {
	Fset *token.FileSet
	Src  string
	F    *ast.File
}

Source source

func NewSource

func NewSource(src string) *Source

NewSource new source

func (*Source) ExprString

func (s *Source) ExprString(typ ast.Expr) string

ExprString expr string

func (*Source) GetDef

func (s *Source) GetDef(name string) string

GetDef get define code

func (*Source) Packages

func (s *Source) Packages(f *ast.Field) (res []string)

Packages get import packages

Source Files