godebug

package
v2.0.3-alpha.2 Latest Latest
Warning

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

Go to latest
Published: May 5, 2020 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const DebugPkgPath = SelfModPkgPath + "/core/godebug/debug"
View Source
const GodebugconfigPkgPath = SelfModPkgPath + "/core/godebug/godebugconfig"
View Source
const SelfModPkgPath = "github.com/jmigpin/editor/v2"

Variables

View Source
var SimplifyStringifyItem = true

Functions

func ProgramPackages

func ProgramPackages(
	ctx context.Context,
	fset *token.FileSet,
	mode packages.LoadMode,
	dir string,
	filenames []string,
	tests bool,
	env []string,
	parseFile func(fset *token.FileSet, filename string, src []byte) (*ast.File, error),
	stderr io.Writer,
) ([]*packages.Package, error)

func SetupGoMods

func SetupGoMods(ctx context.Context, cmd *Cmd, files *Files) error

func StringifyItem

func StringifyItem(item debug.Item) string

func StringifyItemFull

func StringifyItemFull(item debug.Item) string

Types

type AnnFileData

type AnnFileData struct {
	FileSize int
	FileHash []byte
}

type AnnotationOpt

type AnnotationOpt struct {
	Type    AnnotationType
	Opt     string
	Comment *ast.Comment
}

func AnnotationOptInComment

func AnnotationOptInComment(c *ast.Comment, fset *token.FileSet) (*AnnotationOpt, error)

type AnnotationType

type AnnotationType int
const (
	// Order matters, last is the bigger set
	AnnotationTypeNone AnnotationType = iota
	AnnotationTypeOff
	AnnotationTypeBlock
	AnnotationTypeFile
	AnnotationTypeImport  // annotates set of files (importspec)
	AnnotationTypePackage // annotates set of files
	AnnotationTypeModule  // annotates set of packages
)

func AnnotationTypeInString

func AnnotationTypeInString(s string) (AnnotationType, string, error)

type Annotator

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

func NewAnnotator

func NewAnnotator(fset *token.FileSet, nodeAnnTypeFn func(ast.Node) AnnotationType) *Annotator

func (*Annotator) AnnotateAstFile

func (ann *Annotator) AnnotateAstFile(astFile *ast.File, typ AnnotationType)

func (*Annotator) PrintSimple

func (ann *Annotator) PrintSimple(w io.Writer, astFile *ast.File) error

type AnnotatorSet

type AnnotatorSet struct {
	FSet *token.FileSet

	InsertedExitIn struct {
		Main     bool
		TestMain bool
	}
	// contains filtered or unexported fields
}

func NewAnnotatorSet

func NewAnnotatorSet() *AnnotatorSet

func (*AnnotatorSet) AnnotateAstFile

func (annset *AnnotatorSet) AnnotateAstFile(astFile *ast.File, filename string, files *Files) error

func (*AnnotatorSet) ConfigContent

func (annset *AnnotatorSet) ConfigContent(network, addr string) string

func (*AnnotatorSet) TestMainSources

func (annset *AnnotatorSet) TestMainSources() []*TestMainSrc

type Client

type Client struct {
	Conn     net.Conn
	Messages chan interface{}
	// contains filtered or unexported fields
}

func NewClient

func NewClient(ctx context.Context, network, addr string) (*Client, error)

func (*Client) Close

func (client *Client) Close() error

func (*Client) Wait

func (client *Client) Wait()

type Cmd

type Cmd struct {
	Client *Client
	Dir    string
	Stdout io.Writer
	Stderr io.Writer

	NoPreBuild bool // useful for tests
	// contains filtered or unexported fields
}

func NewCmd

func NewCmd() *Cmd

func (*Cmd) Cleanup

func (cmd *Cmd) Cleanup()

func (*Cmd) Error

func (cmd *Cmd) Error(err error)

func (*Cmd) Printf

func (cmd *Cmd) Printf(format string, a ...interface{}) (int, error)

func (*Cmd) RequestFileSetPositions

func (cmd *Cmd) RequestFileSetPositions() error

func (*Cmd) RequestStart

func (cmd *Cmd) RequestStart() error

func (*Cmd) Start

func (cmd *Cmd) Start(ctx context.Context, args []string) (done bool, _ error)

func (*Cmd) Wait

func (cmd *Cmd) Wait() error

type Ctx

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

func (*Ctx) SetValue

func (ctx *Ctx) SetValue(vname string, value interface{})

func (*Ctx) Value

func (ctx *Ctx) Value(vname string) (interface{}, *Ctx)

func (*Ctx) ValueBool

func (ctx *Ctx) ValueBool(name string) bool

func (*Ctx) WithBool

func (ctx *Ctx) WithBool(name string, v bool) *Ctx

func (*Ctx) WithValue

func (ctx *Ctx) WithValue(vname string, value interface{}) *Ctx

type ExprIter

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

type FilePack

type FilePack struct {
	Name string
	Data string
}

func DebugFilePacks

func DebugFilePacks() []*FilePack

type Files

type Files struct {
	Dir string
	// contains filtered or unexported fields
}

Finds the set of files that need to be annotated/copied.

func NewFiles

func NewFiles(fset *token.FileSet, noModules bool, stderr io.Writer) *Files

func (*Files) Add

func (files *Files) Add(filenames ...string)

Add filenames (including directories).

func (*Files) DebugPkgFilename

func (files *Files) DebugPkgFilename(filename string) string

func (*Files) Do

func (files *Files) Do(ctx context.Context, filenames []string, tests bool, env []string) error

func (*Files) GodebugconfigPkgFilename

func (files *Files) GodebugconfigPkgFilename(filename string) string

func (*Files) NodeAnnType

func (files *Files) NodeAnnType(n ast.Node) AnnotationType

type ItemStringifier

type ItemStringifier struct {
	Str            string
	FullStr        bool
	SimplifyResult string
}

type StmtIter

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

type TestMainSrc

type TestMainSrc struct {
	Dir string
	Src string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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