gobuf

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package gobuf builds Go source for generated page code.

Index

Constants

View Source
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 New

func New() *GoBuf

New returns an empty buffer.

func (*GoBuf) Formatted

func (b *GoBuf) Formatted() ([]byte, error)

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) String

func (b *GoBuf) String() string

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

func (b *GoBuf) WriteLineReset(name string)

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

func (b *GoBuf) WritePrintString(s string)

WritePrintString adds s to the literal output that the generated code writes to w.

func (*GoBuf) WriteQuotedString

func (b *GoBuf) WriteQuotedString(s string, suffixes ...string)

WriteQuotedString writes s as a Go string literal, followed by the suffixes.

func (*GoBuf) WriteString

func (b *GoBuf) WriteString(s string)

WriteString writes Go source.

func (*GoBuf) WriteStringLn

func (b *GoBuf) WriteStringLn(s string)

WriteStringLn writes Go source and a newline.

Jump to

Keyboard shortcuts

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