Documentation
¶
Overview ¶
Package purge strips the bodies of a Go source file so that only its declarations remain to be parsed.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PurgeFuncBodies ¶
PurgeFuncBodies returns a copy of src in which the contents of each outermost {...} region have been deleted, except for struct and interface type bodies and the bodies of length-elided array literals ([...]T), whose element count is part of the type. It includes function bodies, function-literal bodies, and the bodies of slice, map, and explicitly-sized array composite literals (whose contents don't affect the type of the enclosing declaration). This reduces the amount of work required to parse the top-level declarations.
PurgeFuncBodies keeps the line breaks of what it deletes, so every line keeps its number; only columns after a deletion on its line move. If the input is invalid, parsing the output of PurgeFuncBodies may result in a different tree due to its effects on parser error recovery.
Types ¶
This section is empty.