srceditor

package
v0.3.0-beta Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2018 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultImportName     = "__goapptrace_tracer"
	DefaultImportPath     = "github.com/yuuki0xff/goapptrace/tracer/logger"
	DefaultVariablePrefix = "__goapptrace_tracer_var_"
)
View Source
const DefaultArrayCap = 1000
View Source
const DefaultBufferCap = 1 << 18 // about 256KiB
View Source
const DefaultCaps = 1024

Variables

This section is empty.

Functions

func AtomicReadWrite

func AtomicReadWrite(fname string, fn func(r io.Reader, w io.Writer) error) error

func FindFiles

func FindFiles(fileOrDir string) ([]string, error)

returns all file paths of golang source in all sub-directories.

Types

type CodeEditor

type CodeEditor struct {
	// trueなら、エクスポートされた関数にのみトレース用のコードを追加する。
	// falseなら、全ての関数に対してトレース用のコードを追加する。
	ExportedOnly bool
	// import名や変数名につけるprefix。既存の変数などと名前が衝突しないようにするために設定する。
	Prefix string
	// contains filtered or unexported fields
}

既存のソースコードを編集し、トレース用のコードを追加する。

func (*CodeEditor) EditFile

func (ce *CodeEditor) EditFile(inFile, outFile string) error

inFileにトレース用コードを追加し、outFileに書き出す。 inFileの内容は変更されない。

func (*CodeEditor) EditFileOverwrite

func (ce *CodeEditor) EditFileOverwrite(fname string) error

fnameにトレース用のコードを追加する。 指定されたファイルは上書きされる。

type DeleteNode

type DeleteNode struct {
	Node
	Pos token.Pos
	End token.Pos
}

type InsertNode

type InsertNode struct {
	Node
	Pos token.Pos
	Src []byte
}

type Node

type Node interface{}

type NodeList

type NodeList struct {
	OrigSrc []byte
	File    *ast.File
	// contains filtered or unexported fields
}

func (*NodeList) Add

func (nl *NodeList) Add(nodes ...Node)

func (*NodeList) Format

func (nl *NodeList) Format() ([]byte, error)

type NodeSorter

type NodeSorter []Node

func (NodeSorter) Len

func (n NodeSorter) Len() int

func (NodeSorter) Less

func (n NodeSorter) Less(i, j int) bool

func (NodeSorter) Swap

func (n NodeSorter) Swap(i, j int)

type Template

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

type TemplateData

type TemplateData struct {
	ImportName     string
	ImportPath     string
	VariablePrefix string
	D              interface{} // extra data
}

Jump to

Keyboard shortcuts

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