Help us shape the future of Go! Take the 2026 Go Developer Survey

reachability

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package reachability decides, cheaply and conservatively, whether the code holding a finding is called from anywhere in the project.

This is not interprocedural analysis. It answers one narrow question — is the enclosing symbol referenced anywhere outside its own declaration — and answers "unknown" whenever it cannot be sure. That is enough to separate a weakness on a live path from one in a helper nobody calls any more, which is the difference between a queue people work through and a queue people mute.

Every guard here exists to avoid the expensive mistake: calling live code dead. Frameworks invoke handlers by name, exported symbols are called by other projects, and reflection is invisible to a text search. When any of those apply, the answer is "unknown".

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Analyzer

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

Analyzer counts references to symbols across a project, caching the file list and the contents it reads for the duration of a scan.

func New

func New() *Analyzer

New returns an Analyzer with empty caches.

func (*Analyzer) UnreachableSymbols

func (a *Analyzer) UnreachableSymbols(
	ctx context.Context, root string, refs []ports.SymbolRef,
) mo.Result[map[string]bool]

UnreachableSymbols returns, for each symbol asked about, whether nothing in the project references it.

A symbol absent from the result map is "unknown", not "reachable": callers must treat the two differently.

Jump to

Keyboard shortcuts

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