Documentation
¶
Overview ¶
Package gobuf builds Go source for generated page code.
Index ¶
- Constants
- type GoBuf
- func (b *GoBuf) Formatted() ([]byte, error)
- func (b *GoBuf) String() string
- func (b *GoBuf) WriteConsts()
- func (b *GoBuf) WriteLineReset(name string)
- func (b *GoBuf) WritePrintString(s string)
- func (b *GoBuf) WriteQuotedString(s string, suffixes ...string)
- func (b *GoBuf) WriteString(s string)
- func (b *GoBuf) WriteStringLn(s string)
Constants ¶
const Header = "// Code generated by aicoded. DO NOT EDIT.\n\n"
Header starts every generated Go file.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GoBuf ¶
type GoBuf struct {
// contains filtered or unexported fields
}
GoBuf collects Go source. Literal output written with WritePrintString is gathered into string constants named _html0, _html1, … in order of first use; identical strings share one.
func (*GoBuf) Formatted ¶
Formatted returns the source formatted by go/format, with each comment of WriteLineReset made the //line directive that names the line after it.
func (*GoBuf) WriteConsts ¶
func (b *GoBuf) WriteConsts()
WriteConsts writes the string constants used so far as one const block. It writes nothing when there are none.
func (*GoBuf) WriteLineReset ¶
WriteLineReset ends code that //line directives map to a template, on a line of its own: in the source Formatted returns, the lines that follow are those of the generated file name itself. Literal output not yet written comes after it.
func (*GoBuf) WritePrintString ¶
WritePrintString adds s to the literal output that the generated code writes to w.
func (*GoBuf) WriteQuotedString ¶
WriteQuotedString writes s as a Go string literal, followed by the suffixes.
func (*GoBuf) WriteStringLn ¶
WriteStringLn writes Go source and a newline.