pub struct Go;Expand description
Go language support.
Trait Implementations§
Source§impl Language for Go
impl Language for Go
Source§fn extensions(&self) -> &'static [&'static str]
fn extensions(&self) -> &'static [&'static str]
File extensions this language handles (e.g., [“py”, “pyi”, “pyw”])
Source§fn grammar_name(&self) -> &'static str
fn grammar_name(&self) -> &'static str
Grammar name for arborium (e.g., “python”, “rust”)
Source§fn has_symbols(&self) -> bool
fn has_symbols(&self) -> bool
Whether this language has code symbols (functions, classes, etc.)
Source§fn container_kinds(&self) -> &'static [&'static str]
fn container_kinds(&self) -> &'static [&'static str]
Container nodes that can hold methods (class, impl, module)
Source§fn function_kinds(&self) -> &'static [&'static str]
fn function_kinds(&self) -> &'static [&'static str]
Function/method definition nodes
Source§fn type_kinds(&self) -> &'static [&'static str]
fn type_kinds(&self) -> &'static [&'static str]
Type definition nodes (struct, enum, interface, type alias)
Source§fn import_kinds(&self) -> &'static [&'static str]
fn import_kinds(&self) -> &'static [&'static str]
Import statement nodes
Source§fn public_symbol_kinds(&self) -> &'static [&'static str]
fn public_symbol_kinds(&self) -> &'static [&'static str]
AST node kinds that may contain publicly visible symbols.
For JS/TS: export_statement nodes.
For Go/Java/Python: function/class/type declaration nodes.
The extract_public_symbols() method filters by actual visibility.
Source§fn visibility_mechanism(&self) -> VisibilityMechanism
fn visibility_mechanism(&self) -> VisibilityMechanism
How this language determines symbol visibility
Source§fn scope_creating_kinds(&self) -> &'static [&'static str]
fn scope_creating_kinds(&self) -> &'static [&'static str]
Nodes that create new variable scopes (for scope analysis)
Includes: loops, blocks, comprehensions, lambdas, with statements
Note: Functions and containers (from function_kinds/container_kinds) also create scopes
Source§fn control_flow_kinds(&self) -> &'static [&'static str]
fn control_flow_kinds(&self) -> &'static [&'static str]
Nodes that affect control flow (for CFG analysis)
Includes: if, for, while, return, break, continue, try, match
Source§fn complexity_nodes(&self) -> &'static [&'static str]
fn complexity_nodes(&self) -> &'static [&'static str]
Nodes that increase cyclomatic complexity
Source§fn nesting_nodes(&self) -> &'static [&'static str]
fn nesting_nodes(&self) -> &'static [&'static str]
Nodes that indicate nesting depth
Source§fn signature_suffix(&self) -> &'static str
fn signature_suffix(&self) -> &'static str
Suffix to append to signatures for tree-sitter parsing.
Function signatures are incomplete code fragments that need closing tokens
to parse correctly (e.g., Rust
fn foo() needs {}, Lua function foo() needs end).
Returns the suffix to append, or empty string if none needed.Source§fn extract_function(
&self,
node: &Node<'_>,
content: &str,
in_container: bool,
) -> Option<Symbol>
fn extract_function( &self, node: &Node<'_>, content: &str, in_container: bool, ) -> Option<Symbol>
Extract symbol from a function/method node
Source§fn extract_container(&self, _node: &Node<'_>, _content: &str) -> Option<Symbol>
fn extract_container(&self, _node: &Node<'_>, _content: &str) -> Option<Symbol>
Extract symbol from a container node (class, impl, module)
Source§fn extract_type(&self, node: &Node<'_>, content: &str) -> Option<Symbol>
fn extract_type(&self, node: &Node<'_>, content: &str) -> Option<Symbol>
Extract symbol from a type definition node
Source§fn extract_imports(&self, node: &Node<'_>, content: &str) -> Vec<Import>
fn extract_imports(&self, node: &Node<'_>, content: &str) -> Vec<Import>
Extract imports from an import node (may return multiple)
Source§fn format_import(&self, import: &Import, _names: Option<&[&str]>) -> String
fn format_import(&self, import: &Import, _names: Option<&[&str]>) -> String
Format an import as source code.
If
names is Some, only include those names (for multi-import filtering).
If names is None, format the complete import.Source§fn extract_public_symbols(&self, node: &Node<'_>, content: &str) -> Vec<Export>
fn extract_public_symbols(&self, node: &Node<'_>, content: &str) -> Vec<Export>
Extract public symbols from a node.
The node is one of the kinds from public_symbol_kinds().
For JS/TS: extracts exported names from export statements.
For Go/Java/Python: checks visibility and returns public symbols.
Source§fn is_public(&self, node: &Node<'_>, content: &str) -> bool
fn is_public(&self, node: &Node<'_>, content: &str) -> bool
Check if a node is public/exported
Source§fn get_visibility(&self, node: &Node<'_>, content: &str) -> Visibility
fn get_visibility(&self, node: &Node<'_>, content: &str) -> Visibility
Get visibility of a node
Source§fn is_test_symbol(&self, symbol: &Symbol) -> bool
fn is_test_symbol(&self, symbol: &Symbol) -> bool
Check if a symbol is a test (for filtering).
Each language must implement this - test conventions are language-specific.
Source§fn embedded_content(
&self,
_node: &Node<'_>,
_content: &str,
) -> Option<EmbeddedBlock>
fn embedded_content( &self, _node: &Node<'_>, _content: &str, ) -> Option<EmbeddedBlock>
Extract embedded content from a node (e.g., JS/CSS in Vue/HTML).
Returns None for nodes that don’t contain embedded code in another language.
Source§fn extract_docstring(&self, _node: &Node<'_>, _content: &str) -> Option<String>
fn extract_docstring(&self, _node: &Node<'_>, _content: &str) -> Option<String>
Extract docstring/doc comment for a node
Source§fn extract_attributes(&self, _node: &Node<'_>, _content: &str) -> Vec<String>
fn extract_attributes(&self, _node: &Node<'_>, _content: &str) -> Vec<String>
Extract attributes/decorators for a node (e.g., #test, @Test)
Source§fn container_body<'a>(&self, node: &'a Node<'a>) -> Option<Node<'a>>
fn container_body<'a>(&self, node: &'a Node<'a>) -> Option<Node<'a>>
Find the body node of a container (for prepend/append)
Source§fn body_has_docstring(&self, _body: &Node<'_>, _content: &str) -> bool
fn body_has_docstring(&self, _body: &Node<'_>, _content: &str) -> bool
Detect if first child of body is a docstring
Source§fn node_name<'a>(&self, node: &Node<'_>, content: &'a str) -> Option<&'a str>
fn node_name<'a>(&self, node: &Node<'_>, content: &'a str) -> Option<&'a str>
Get the name of a node (typically via “name” field)
Source§fn file_path_to_module_name(&self, path: &Path) -> Option<String>
fn file_path_to_module_name(&self, path: &Path) -> Option<String>
Convert a file path to a module name for this language.
Used to find “importers” - files that import a given file.
Returns None for languages without module systems or where not applicable.
Source§fn module_name_to_paths(&self, module: &str) -> Vec<String>
fn module_name_to_paths(&self, module: &str) -> Vec<String>
Convert a module name to candidate file paths (inverse of file_path_to_module_name).
Returns relative paths that could contain the module.
Used for wildcard import resolution (e.g.,
from foo import *).Source§fn lang_key(&self) -> &'static str
fn lang_key(&self) -> &'static str
Language key for package index cache (e.g., “python”, “go”, “js”).
Source§fn resolve_local_import(
&self,
import_path: &str,
current_file: &Path,
_project_root: &Path,
) -> Option<PathBuf>
fn resolve_local_import( &self, import_path: &str, current_file: &Path, _project_root: &Path, ) -> Option<PathBuf>
Resolve a local import within the project. Read more
Source§fn resolve_external_import(
&self,
import_name: &str,
_project_root: &Path,
) -> Option<ResolvedPackage>
fn resolve_external_import( &self, import_name: &str, _project_root: &Path, ) -> Option<ResolvedPackage>
Resolve an external import to its source location. Read more
Source§fn is_stdlib_import(&self, import_name: &str, _project_root: &Path) -> bool
fn is_stdlib_import(&self, import_name: &str, _project_root: &Path) -> bool
Check if an import is from the standard library.
Source§fn get_version(&self, _project_root: &Path) -> Option<String>
fn get_version(&self, _project_root: &Path) -> Option<String>
Get the language/runtime version (for package index versioning).
Source§fn find_package_cache(&self, _project_root: &Path) -> Option<PathBuf>
fn find_package_cache(&self, _project_root: &Path) -> Option<PathBuf>
Find package cache/installation directory.
Source§fn indexable_extensions(&self) -> &'static [&'static str]
fn indexable_extensions(&self) -> &'static [&'static str]
File extensions to index when caching a package.
Source§fn find_stdlib(&self, _project_root: &Path) -> Option<PathBuf>
fn find_stdlib(&self, _project_root: &Path) -> Option<PathBuf>
Find standard library directory (if applicable).
Returns None for languages without a separate stdlib to index.
Source§fn package_sources(&self, project_root: &Path) -> Vec<PackageSource>
fn package_sources(&self, project_root: &Path) -> Vec<PackageSource>
Return package sources to index for this language.
Each source describes a directory containing packages.
Source§fn should_skip_package_entry(&self, name: &str, is_dir: bool) -> bool
fn should_skip_package_entry(&self, name: &str, is_dir: bool) -> bool
Should this entry be skipped when indexing packages?
Called for each file/directory in package directories.
Use helper functions
skip_dotfiles() and has_extension(name, self.indexable_extensions()) for common checks.Source§fn package_module_name(&self, entry_name: &str) -> String
fn package_module_name(&self, entry_name: &str) -> String
Get the module/package name from a directory entry name.
Source§fn discover_packages(&self, source: &PackageSource) -> Vec<(String, PathBuf)>
fn discover_packages(&self, source: &PackageSource) -> Vec<(String, PathBuf)>
Discover packages in a source directory.
Returns (package_name, path) pairs for all packages found.
Use provided helpers: discover_flat_packages, discover_recursive_packages, discover_npm_scoped_packages.
Source§fn find_package_entry(&self, path: &Path) -> Option<PathBuf>
fn find_package_entry(&self, path: &Path) -> Option<PathBuf>
Find the entry point file for a package path.
If path is a file, returns it directly.
If path is a directory, looks for language-specific entry points.
Source§fn discover_flat_packages(&self, source_path: &Path) -> Vec<(String, PathBuf)>
fn discover_flat_packages(&self, source_path: &Path) -> Vec<(String, PathBuf)>
Discover packages in a flat directory (each entry is a package).
Auto Trait Implementations§
impl Freeze for Go
impl RefUnwindSafe for Go
impl Send for Go
impl Sync for Go
impl Unpin for Go
impl UnwindSafe for Go
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request