class

Analyzer::Go::Chi

Inherits Analyzer < FileHelper < Reference < Object

Constants

IMPORT_MARKER = "github.com/go-chi/chi"

Go enforces per-file imports, so any file using chi's router types must mention the package path. Filter on this marker to avoid touching the bulk of files in projects whose detection matched on a single dummy/fixture file (the chi extractor is loose enough that another framework's verb calls would otherwise surface as chi routes).

IMPORT_MARKER_RE = Regex.union(IMPORT_MARKER)

Whole-file gates, run on every .go in the tree.

MOUNT_CALL_RE = /\.Mount\(/

Class methods

tech_name
Source

Instance methods

analyze
Source
analyze_router_function(file_path : String, func_name : String, package_files : Hash(String, Array(String)) | Nil = nil, file_contents_cache : Hash(String, String) | Nil = nil, file_lines_cache : Hash(String, Array(String)) | Nil = nil, recv_type : String | Nil = nil) : Array(Endpoint)

Extracts endpoints from a router function definition, searching across all .go files in the same directory (Go package) if not found in the given file.

Uses the tree-sitter walker too, but scoped down to just the target function's declaration so the returned routes are relative to the function body — caller slaps on the Mount prefix. When recv_type is given, the target is a method (func (r Type) Name()) and only the declaration on that receiver type is matched.

Source
get_param(line : String, pattern : String) : Param
Source
tech

Instance-side view of the same declaration. The per-file rescues live on this base class, which has no way to name the analyzer that is running inside them, so a skipped file could not be attributed to a tech. Deriving it from analyzer_for keeps the name written exactly once.

Source