parsers.go

Go regex-based parser. Extracts functions, types, structs, methods, and interfaces from Go source files.

📄 /home/runner/work/autoredocs/autoredocs/src/autoredocs/parsers/go.py

Classes

class
class GoParser(BaseParser)
Regex-based parser for Go source files.
📍 Line 68

Methods

def
def parse_file(self, filepath: str | Path) -> ModuleDoc | None
Parse a Go source file and return a ModuleDoc.
def
def _extract_methods(self, source: str, struct_name: str) -> list[FunctionDoc]
Find all methods with a receiver of the given struct type.

Functions

def
def _build_godoc_map(source: str) -> dict[int, str]
Map declaration positions to their preceding godoc comments.
📍 Line 176
def
def _clean_godoc(raw: str) -> str
Clean Go doc comment lines.
📍 Line 186
def
def _parse_go_params(raw: str) -> list[ArgInfo]
Parse Go function parameters.
📍 Line 200