golang

package
v1.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CodeAnalyzer

type CodeAnalyzer struct {
	// contains filtered or unexported fields
}

CodeAnalyzer mirrors the tutorial's analyzer to extract rich package info.

func NewCodeAnalyzer

func NewCodeAnalyzer() *CodeAnalyzer

func (*CodeAnalyzer) AnalyzePackage

func (ca *CodeAnalyzer) AnalyzePackage(dir string) (*PackageInfo, error)

func (*CodeAnalyzer) AnalyzePaths

func (ca *CodeAnalyzer) AnalyzePaths(paths []string) ([]codetypes.CodeChunk, error)

AnalyzePaths walks directories, analyzes Go packages using CodeAnalyzer, and converts results to CodeChunks.

type ConstantInfo

type ConstantInfo struct {
	Name        string `json:"name"`
	Type        string `json:"type"`
	Value       string `json:"value"`
	Description string `json:"description"`
	IsExported  bool   `json:"is_exported"`
	FilePath    string `json:"file_path,omitempty"`
	StartLine   int    `json:"start_line,omitempty"`
	EndLine     int    `json:"end_line,omitempty"`
}

ConstantInfo describes a constant declaration

type ExampleInfo

type ExampleInfo struct {
	Name string `json:"name"`
	Code string `json:"code"`
	Doc  string `json:"doc"`
}

ExampleInfo describes a code example

type FunctionInfo

type FunctionInfo struct {
	Name        string                 `json:"name"`
	Signature   string                 `json:"signature"`
	Description string                 `json:"description"`
	Parameters  []codetypes.ParamInfo  `json:"parameters"`
	Returns     []codetypes.ReturnInfo `json:"returns"`
	Examples    []string               `json:"examples"`
	IsExported  bool                   `json:"is_exported"`
	IsMethod    bool                   `json:"is_method"`
	Receiver    string                 `json:"receiver,omitempty"`
	FilePath    string                 `json:"file_path,omitempty"`
	StartLine   int                    `json:"start_line,omitempty"`
	EndLine     int                    `json:"end_line,omitempty"`
	Code        string                 `json:"code,omitempty"`
}

FunctionInfo describes a function or method

type PackageInfo

type PackageInfo struct {
	Name        string         `json:"name"`
	Path        string         `json:"path"`
	Description string         `json:"description"`
	Functions   []FunctionInfo `json:"functions"`
	Types       []TypeInfo     `json:"types"`
	Constants   []ConstantInfo `json:"constants"`
	Variables   []VariableInfo `json:"variables"`
	Examples    []ExampleInfo  `json:"examples"`
	Imports     []string       `json:"imports"`
}

PackageInfo contains comprehensive information about a Go package

type TypeInfo

type TypeInfo struct {
	Name        string                 `json:"name"`
	Kind        string                 `json:"kind"` // struct, interface, alias, etc.
	Description string                 `json:"description"`
	Fields      []codetypes.FieldInfo  `json:"fields,omitempty"`
	Methods     []codetypes.MethodInfo `json:"methods,omitempty"`
	IsExported  bool                   `json:"is_exported"`
	FilePath    string                 `json:"file_path,omitempty"`
	StartLine   int                    `json:"start_line,omitempty"`
	EndLine     int                    `json:"end_line,omitempty"`
	Code        string                 `json:"code,omitempty"`
}

TypeInfo describes a type declaration (struct, interface, alias, etc.)

type VariableInfo

type VariableInfo struct {
	Name        string `json:"name"`
	Type        string `json:"type"`
	Description string `json:"description"`
	IsExported  bool   `json:"is_exported"`
	FilePath    string `json:"file_path,omitempty"`
	StartLine   int    `json:"start_line,omitempty"`
	EndLine     int    `json:"end_line,omitempty"`
}

VariableInfo describes a variable declaration

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL