astanalysis

package
v0.0.0-...-340027c Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package astanalysis provides Go code analysis using AST parsing

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Analyzer

type Analyzer struct {
	RepoPath string
	Fset     *token.FileSet
}

Analyzer provides AST-based code analysis

func NewAnalyzer

func NewAnalyzer(repoPath string) *Analyzer

NewAnalyzer creates a new AST analyzer

func (*Analyzer) AnalyzeFile

func (a *Analyzer) AnalyzeFile(path string) (*FileInfo, error)

AnalyzeFile parses a single Go file and returns its structure

func (*Analyzer) AnalyzePackage

func (a *Analyzer) AnalyzePackage(pkgPath string) ([]*FileInfo, error)

AnalyzePackage analyzes all Go files in a package

func (*Analyzer) FindUnusedCode

func (a *Analyzer) FindUnusedCode(pkgPath string) ([]string, error)

FindUnusedCode finds potentially unused functions and variables

type FieldInfo

type FieldInfo struct {
	Name string
	Type string
	Tag  string
}

FieldInfo represents a struct field

type FileInfo

type FileInfo struct {
	Path       string
	Package    string
	Imports    []string
	Functions  []FunctionInfo
	Structs    []StructInfo
	Interfaces []InterfaceInfo
	Variables  []VariableInfo
}

FileInfo contains information about a Go file

type FunctionInfo

type FunctionInfo struct {
	Name       string
	Receiver   string // For methods
	Params     []string
	Returns    []string
	Line       int
	IsExported bool
	Doc        string
}

FunctionInfo contains function details

type InterfaceInfo

type InterfaceInfo struct {
	Name       string
	Methods    []string
	Line       int
	IsExported bool
	Doc        string
}

InterfaceInfo contains interface details

type StructInfo

type StructInfo struct {
	Name       string
	Fields     []FieldInfo
	Line       int
	IsExported bool
	Doc        string
}

StructInfo contains struct details

type VariableInfo

type VariableInfo struct {
	Name       string
	Type       string
	Line       int
	IsExported bool
	IsConst    bool
}

VariableInfo contains variable details

Jump to

Keyboard shortcuts

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