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

spec

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Lines added in v0.3.0

func Lines(content string) []string

Lines returns the canonical line view used for prompt numbering and web annotations. It normalizes CRLF/CR to LF and treats a trailing newline as a terminator, not as an additional empty line.

Types

type Spec

type Spec struct {
	Path      string
	Hash      string // "sha256:<hex>"
	Raw       string // original content
	Numbered  string // content with "L1: …" prefixes
	LineCount int
}

Spec holds a loaded specification file with derived metadata.

func Load

func Load(path string) (*Spec, error)

Load reads a spec file from disk, computes its hash, and line-numbers its content.

func LoadText added in v0.3.0

func LoadText(name, raw string) (*Spec, error)

LoadText constructs a Spec from in-memory text, using name as the display path.

func New added in v0.3.0

func New(path, raw string) *Spec

New constructs a Spec from raw text, computes its hash, and line-numbers it.

Jump to

Keyboard shortcuts

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