surface

package
v1.0.3-dev.1 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package surface renders a module's exported Go surface as text, so a golden file can pin it and a test can fail on any drift.

It parses and never type-checks, with the standard library alone, so the pin adds no dependency to the module. Its one use of go/types is a name lookup in the universe scope, which is a table rather than a type checker.

Index

Constants

View Source
const Header = "# forgeapi exported surface, rendered by internal/surface. Regenerate with:\n" +
	"#   UPDATE_GOLDEN=1 go test ./... -run TestExportedSurfaceMatchesGolden\n"

Header is the first line of the rendered surface. It names the generator so a reader of the golden file knows the file is not hand-maintained.

Variables

This section is empty.

Functions

func Generate

func Generate(dir string) ([]byte, error)

Generate renders every exported declaration of every package under dir. It sorts top-level declarations by symbol path, a method as "Type.Method", so reordering a file changes nothing.

Types

This section is empty.

Jump to

Keyboard shortcuts

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