Skip to main content

Module go

Module go 

Source
Expand description

Rendering the Go CST. Spec §5.

One style, gofmt’s: tabs for indentation, the opening brace on the same line, // comments. Tabs and not spaces because gofmt is not a preference in Go — go vet does not check formatting, but every reader of a generated file runs it, and a file that changes under it is a diff nobody asked for.

Nothing is decided here. A Go type reads left to right and carries its own length and pointer depth, so unlike crate::c there is no declarator to split around a name: a field is the name, a space, and the type.

Functions§

decl
Render one declaration, for a caller that has only one.
file
Render a whole file.
ident
The identifier a name renders as, for a caller assembling one.
type_
Render one type, for a caller that has only one.