Package printer
import "go/printer"
Package printer implements printing of AST nodes.
Package files
nodes.go printer.goConstants
General printing is controlled with these Config.Mode flags.
const (
RawFormat uint = 1 << iota // do not use a tabwriter; if set, UseSpaces is ignored
TabIndent // use tabs for indentation independent of UseSpaces
UseSpaces // use spaces instead of tabs for alignment
)
func Fprint
func Fprint(output io.Writer, fset *token.FileSet, node interface{}) os.Error
Fprint "pretty-prints" an AST node to output. It calls Config.Fprint with default settings.
type Config
A Config node controls the output of Fprint.
type Config struct {
Mode uint // default: 0
Tabwidth int // default: 8
}
func (*Config) Fprint
func (cfg *Config) Fprint(output io.Writer, fset *token.FileSet, node interface{}) (int, os.Error)
Fprint "pretty-prints" an AST node to output and returns the number of bytes written and an error (if any) for a given configuration cfg. Position information is interpreted relative to the file set fset. The node type must be *ast.File, or assignment-compatible to ast.Expr, ast.Decl, ast.Spec, or ast.Stmt.
Need more packages? The Package Dashboard provides a list of goinstallable packages.
Subdirectories
| Name | Synopsis | |
|---|---|---|
| .. | ||
| testdata | Package parser implements a parser for Go source files. |