A modular Go tool that analyzes Go projects and extracts structured code chunks for semantic search and analysis.
# Build the tool
make build
# Analyze a Go project
./bin/go-ast-parser -path /path/to/your/go/project
# Output: code_chunks.json
- ✅ Comprehensive Analysis - Processes main module + vendor dependencies
- ✅ Rich Metadata - Types, symbols, functions, methods extraction
- ✅ JSON Output - Structured data for semantic search systems
- ✅ Modular Architecture - Clean, testable, maintainable codebase
- ✅ Type-Safe Analysis - Uses official Go AST and type checking tools
cmd/go-ast-parser
- CLI entry pointpkg/loader
- Package loading (main + vendor)pkg/parser
- AST parsing & chunk extractionpkg/analyzer
- Type analysis & symbol extractionpkg/transform
- Code transformationspkg/output
- JSON serializationpkg/types
- Core data structures
📖 Full Architecture Documentation
# Available commands
make help
# Build binary
make build
# Clean artifacts
make clean
{
"id": "file_path:line_start-line_end-entity_name",
"document": "actual_code_content",
"metadata": {
"file_path": "/path/to/file.go",
"package_name": "main",
"entity_type": "function",
"accessed_symbols": ["package.Symbol"]
}
}
- Go 1.23+
- Target project must have
go.mod
file
For detailed architecture documentation with diagrams, see ARCHITECTURE.md