Documentation
¶
Overview ¶
Package astutil defines utilities for ast and dst.
parser defines general utilities for codegen.
Index ¶
- func BufPrintf(w io.Writer) (func(format string, args ...any), func() error)
- func FieldAst(st *ast.StructType) iter.Seq[FieldDescAst]
- func FieldDst(st *dst.StructType) iter.Seq[FieldDescDst]
- func Nth[I ints](d I) string
- func PrintAstExprPanicking(expr ast.Expr) string
- func PrintFieldDesc(typeName string, i int, field *types.Var) string
- func PrintFileHeader(w io.Writer, af *ast.File, fset *token.FileSet) error
- func PrintTypeParamsAst(ts *ast.TypeSpec) string
- func PrintTypeParamsDst(ts *dst.TypeSpec) string
- func TrimPackageComment(f *dst.File)
- func TypeToAst(ty types.Type, pkgPath string, importMap imports.ImportMap) ast.Expr
- func TypeToDst(ty types.Type, pkgPath string, importMap imports.ImportMap) dst.Expr
- type FieldDescAst
- type FieldDescDst
- type Parser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BufPrintf ¶
BufPrintf wraps w and returns it in a function which works as like printf. Call second return value to retrieve io error in case it happens.
func FieldAst ¶
func FieldAst(st *ast.StructType) iter.Seq[FieldDescAst]
func FieldDst ¶
func FieldDst(st *dst.StructType) iter.Seq[FieldDescDst]
func PrintAstExprPanicking ¶
func PrintTypeParamsAst ¶
func PrintTypeParamsDst ¶
func TrimPackageComment ¶
TrimPackageComment removes all package comment lines except build constratints.
Types ¶
type FieldDescAst ¶
Click to show internal directories.
Click to hide internal directories.