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

codemap

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

ENGMODEL-OWNER-UNIT: FU-CODEMAP-INFERENCE

ENGMODEL-OWNER-UNIT: FU-CODEMAP-INFERENCE

ENGMODEL-OWNER-UNIT: FU-CODEMAP-INFERENCE

ENGMODEL-OWNER-UNIT: FU-CODEMAP-INFERENCE

ENGMODEL-OWNER-UNIT: FU-CODEMAP-INFERENCE

ENGMODEL-OWNER-UNIT: FU-CODEMAP-INFERENCE

Index

Constants

View Source
const MaxArtifactBytes = 512 * 1024

MaxArtifactBytes is the largest container build file or Markdown document the scanner reads; a larger one, like a non-regular file (symlink, device, FIFO), is skipped, so an untrusted repository cannot make the scan read an unbounded or blocking file. It mirrors the MCP server's file index cap.

Variables

This section is empty.

Functions

func ArtifactMarker added in v0.7.0

func ArtifactMarker(path string, src []byte, marker string) (string, int)

ArtifactMarker returns the value of the first comment marker (for example "ENGMODEL-OWNER-UNIT:") in an artifact and its 1-based line, or "" and 0. TRLC-LINKS: REQ-EMG-084 ENGMODEL-LINKS: FU-CODEMAP-INFERENCE

func ArtifactMarkers added in v0.7.0

func ArtifactMarkers(path string, src []byte) (owner string, ownerLine, linksLine, modelLinksLine int)

ArtifactMarkers returns the values and 1-based lines of the ENGMODEL-OWNER-UNIT, TRLC-LINKS and ENGMODEL-LINKS markers of an artifact, parsing it once; an absent marker has value "" and line 0. TRLC-LINKS: REQ-EMG-084 ENGMODEL-LINKS: FU-CODEMAP-INFERENCE

func CommentLines

func CommentLines(path string, src []byte) (map[int]bool, error)

CommentLines returns parser-recognized comment locations, excluding strings. Python locations include only standalone comments, never a string prefix on the same line as an unrelated trailing comment. TRLC-LINKS: REQ-EMG-010

func FileID

func FileID(relPath string) string

FileID returns the CODE identifier of a module-relative file path: the path upper-cased with each run of non-alphanumeric characters folded to one hyphen. ENGMODEL-LINKS: FU-CODEMAP-INFERENCE, CTRL-TRACEABILITY-COVERAGE TRLC-LINKS: REQ-EMG-058

func IsArtifactFile added in v0.7.0

func IsArtifactFile(path string) bool

IsArtifactFile reports whether a path names a container build file or a Markdown document whose comment markers the scanner reads. TRLC-LINKS: REQ-EMG-084 ENGMODEL-LINKS: FU-CODEMAP-INFERENCE

func ReadableArtifact added in v0.7.0

func ReadableArtifact(path string) bool

ReadableArtifact reports whether an artifact file may be read: a regular file of at most MaxArtifactBytes. It does not follow symlinks. TRLC-LINKS: REQ-EMG-084 ENGMODEL-LINKS: FU-CODEMAP-INFERENCE, TB-REPO-WORKSPACE

Types

type ScanOptions

type ScanOptions struct {
	IDBase string
	Skip   func(path string, isDir bool) bool
}

ScanOptions controls identifier derivation and path filtering for ScanWithOptions. IDBase is the directory symbol identifiers are made relative to (the module root); it defaults to the scan root. Skip, when set, excludes files and directories. ENGMODEL-LINKS: FU-CODEMAP-INFERENCE, CTRL-TRACEABILITY-COVERAGE, DEP-LOCAL-WORKSPACE

type Symbol

type Symbol struct {
	TraceID    string
	PartOf     []string
	Implements []string
	ModelLinks []string
	Path       string
	Line       int
	Signature  string
	// IsTest marks a test entry point the language's runner executes (Go TestX/
	// BenchmarkX/FuzzX/ExampleX in _test.go, Rust #[test]-like functions, Python
	// test* functions in test files). Only these verify the requirements they link.
	IsTest bool
	// TestOnly marks code compiled or collected only for tests: every declaration
	// in a Go _test.go or Python test file and Rust items under #[cfg(test)]. It
	// never counts as production implementation.
	TestOnly bool
	// Gates names what an environment-gated Go test waits for: each
	// variable read by os.Getenv or os.LookupEnv, or testing.Short, in an if
	// among its first statements whose body calls t.Skip, t.Skipf or
	// t.SkipNow. It is empty for an ungated test and for non-tests.
	Gates []string
}

ENGMODEL-LINKS: FU-CODEMAP-INFERENCE, CTRL-TRACEABILITY-COVERAGE, DEP-LOCAL-WORKSPACE

func Scan

func Scan(root string) ([]Symbol, []validate.Diagnostic, error)

ENGMODEL-LINKS: FU-CODEMAP-INFERENCE, CTRL-TRACEABILITY-COVERAGE, DEP-LOCAL-WORKSPACE TRLC-LINKS: REQ-EMG-010

func ScanWithOptions

func ScanWithOptions(root string, opts ScanOptions) ([]Symbol, []validate.Diagnostic, error)

ENGMODEL-LINKS: FU-CODEMAP-INFERENCE, CTRL-TRACEABILITY-COVERAGE, DEP-LOCAL-WORKSPACE TRLC-LINKS: REQ-EMG-010, REQ-EMG-057, REQ-EMG-058, REQ-EMG-084

Jump to

Keyboard shortcuts

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