Documentation
¶
Overview ¶
Package gocode is the Go backend for `sf code`: a structural summary of a Go source file (package, imports, types, func/method signatures, consts, vars) and single-symbol slicing — via the stdlib go/parser (syntax only, no type-checking), so it works on any file regardless of whether it compiles.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Slice ¶
Slice returns the source of one named symbol (signature + body + doc) from src, or the available names when not found.
Types ¶
type GoFile ¶
type GoFile struct {
File string `json:"file"`
Package string `json:"package"`
Imports []string `json:"imports"`
Types []GoType `json:"types"`
Funcs []GoFunc `json:"funcs"` // free funcs and methods (Recv set)
Consts []GoValue `json:"consts,omitempty"`
Vars []GoValue `json:"vars,omitempty"`
}
GoFile is the structural summary of one Go source file.
func ReadGo ¶
ReadGo parses a single Go file (syntax only — no type-checking, no build), so it works on any file regardless of whether its package compiles.
func (*GoFile) FilterExported ¶
func (g *GoFile) FilterExported()
FilterExported drops unexported (lowercase) symbols, leaving the API view.