type Generator … // Raw provides direct access to the underlying output stream. func (g *Generator) Raw() io.Writer { … } // SetIndentString sets the string used for one level of indentation. Use // Indent() and Dedent() to control indent level. func (g *Generator) SetIndentString(indent string) { … } // Indent increments the indent level. func (g *Generator) Indent() { … } // Dedent decrements the indent level. func (g *Generator) Dedent() { … } // Linef prints formatted output terminated with a new line. func (g *Generator) Linef(format string, args ...interface{ … } // Printf prints to the internal buffer. func (g *Generator) Printf(format string, args ...interface{ … } // NL prints a new line. func (g *Generator) NL() { … } // Comment writes comment lines prefixed with "// ". func (g *Generator) Comment(lines ...string) { … } // BuildTag outputs a build tag. func (g *Generator) BuildTag(tag string) { … } // AddError records an error in code generation. The first non-nil error will // prevent printing operations from writing anything else, and the error will be // returned from Result(). func (g *Generator) AddError(err error) { … } // Result returns the printed bytes. If any error was recorded with AddError // during code generation, the first such error will be returned here. func (g *Generator) Result() ([]byte, error) { … }