guru

package
v0.0.0-...-5cd0f5d Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2017 License: BSD-3-Clause Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const HasAlias = true

Variables

This section is empty.

Functions

func Fprintf

func Fprintf(w io.Writer, fset *token.FileSet, pos interface{}, format string, args ...interface{})

fprintf prints to w a message of the form "location: message\n" where location is derived from pos.

pos must be one of:

  • a token.Pos, denoting a position
  • an ast.Node, denoting an interval
  • anything with a Pos() method: ssa.Member, ssa.Value, ssa.Instruction, types.Object, pointer.Label, etc.
  • a QueryPos, denoting the extent of the user's query.
  • nil, meaning no position at all.

The output format is is compatible with the 'gnu' compilation-error-regexp in Emacs' compilation mode.

func Run

func Run(mode string, q *Query) error

Run runs an guru query and populates its Fset and Result.

Types

type Query

type Query struct {
	Pos   string         // query position
	Build *build.Context // package loading configuration

	// pointer analysis options
	Scope      []string  // main packages in (*loader.Config).FromArgs syntax
	PTALog     io.Writer // (optional) pointer-analysis log file
	Reflection bool      // model reflection soundly (currently slow).

	// result-printing function
	Output func(*token.FileSet, QueryResult)
}

A Query specifies a single guru query.

type QueryResult

type QueryResult interface {
	// JSON returns the QueryResult in JSON form.
	JSON(fset *token.FileSet) []byte

	// PrintPlain prints the QueryResult in plain text form.
	// The implementation calls printfFunc to print each line of output.
	PrintPlain(printf printfFunc)
}

A QueryResult is an item of output. Each query produces a stream of query results, calling Query.Output for each one.

Directories

Path Synopsis
Package serial defines the guru's schema for -json output.
Package serial defines the guru's schema for -json output.

Jump to

Keyboard shortcuts

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