gnosrc

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package gnosrc renders structural views of Gno package source: a navigation outline (signatures + docs, bodies elided) and verbatim extraction of named declarations with a best-effort dependency header.

Analysis is purely syntactic (go/parser + go/ast); there is deliberately no type checking — resolving method calls or interface dispatch would need a Gno-aware importer and still be incomplete. Dependency lists are therefore navigation hints, never audit evidence, and incompleteness is flagged inline rather than hidden.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Outline

func Outline(files []File) string

Outline renders the navigation view of a package as a txtar archive: one entry per file (entry names are the exact file names), exported declarations with doc comments and bodies elided, unexported declarations as bare signatures, per-file import lists and byte counts. Parse failures and non-.gno files are surfaced as size-only entries — never dropped.

The result is server-rendered (not verbatim source), so the whole archive is neutralized against untrusted-content envelope forgery. It is a navigation aid: names and docs are realm-authored claims, not evidence.

Types

type Extraction

type Extraction struct {
	Body      string
	Found     []string
	Missing   []string
	Available []string
	Errors    []string
}

Extraction is the result of ExtractSymbols. Body holds the matched declarations as a txtar archive (one entry per file that matched, verbatim source bytes). Misses and parse failures are reported, never swallowed: Missing lists requested names that matched nothing, Available the names that could have been requested, Errors any per-file parse failures.

func ExtractSymbols

func ExtractSymbols(files []File, names []string) Extraction

ExtractSymbols returns the verbatim source of the named declarations. Names address top-level declarations ("Transfer", "count") and methods ("Counter.Inc"). Function entries carry a best-effort dependency header (same-package references + imports used); unresolved method calls are counted and flagged inline, because a clean-looking header over an incomplete analysis would hide exactly what an auditor needs to know.

type File

type File struct {
	Name string
	Body string
}

File is one source file of a package as fetched from the chain.

Jump to

Keyboard shortcuts

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