godebug

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2019 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const DebugPkgPath = "github.com/jmigpin/editor/core/godebug/debug"
View Source
const GoDebugConfigPkgPath = "github.com/jmigpin/editor/core/godebug/godebugconfig"

Variables

View Source
var GoDebugConfigFilepath = filepath.FromSlash(GoDebugConfigPkgPath)
View Source
var SimplifyStringifyItem = true

Functions

func ProgramPackages

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

func SetupGoMods

func SetupGoMods(ctx context.Context, cmd *Cmd, files *Files, mainFilename string, tests bool) error

func StringifyItem

func StringifyItem(item debug.Item) string

func StringifyItemFull

func StringifyItemFull(item debug.Item) string

Types

type AnnotationType

type AnnotationType int
const (
	// Order matters, last is the bigger set
	AnnotationTypeNone AnnotationType = iota
	AnnotationTypeOff
	AnnotationTypeBlock
	AnnotationTypeFile
	AnnotationTypePackage // last to be able to stop early
)

func AnnotationTypeInComment

func AnnotationTypeInComment(s string) (AnnotationType, error)

func AnnotationTypeInCommentErrPos

func AnnotationTypeInCommentErrPos(fset *token.FileSet, c *ast.Comment) (AnnotationType, error)

func (AnnotationType) Annotated

func (t AnnotationType) Annotated() bool

type Annotator

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

func NewAnnotator

func NewAnnotator(fset *token.FileSet) *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, typ AnnotationType) error

func (*AnnotatorSet) AnnotateAstFile2

func (annset *AnnotatorSet) AnnotateAstFile2(astFile *ast.File, typ AnnotationType, filename string, src []byte) error

func (*AnnotatorSet) ConfigContent

func (annset *AnnotatorSet) ConfigContent() string

func (*AnnotatorSet) ConfigGoModuleContent

func (annset *AnnotatorSet) ConfigGoModuleContent() string

func (*AnnotatorSet) Print

func (annset *AnnotatorSet) Print(w io.Writer, astFile *ast.File) error

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) (*Client, error)

func (*Client) Close

func (client *Client) Close() error

func (*Client) Wait

func (client *Client) Wait()

type Cmd

type Cmd struct {
	Client    *Client
	NoModules bool // not in go.mod modules

	Dir    string // "" will use current dir
	Stdout io.Writer
	Stderr io.Writer
	// contains filtered or unexported fields
}

func NewCmd

func NewCmd() *Cmd

func (*Cmd) Cleanup

func (cmd *Cmd) Cleanup()

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) *Files

func (*Files) Add

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

Add filenames (including directories).

func (*Files) Do

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

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