errata

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package errata is the declared overlay of defects in OMG-published material, and the entries for the bundled standard library; published bytes are never rewritten.

Index

Constants

View Source
const IssuesPath = "docs/project/omg-issues.md"

IssuesPath is the page every entry must be documented in.

View Source
const LibraryRoot = "internal/workspace/libs/stdlib"

LibraryRoot is the repository path of the bundled standard library, whose files are OMG-published material too. Entries under it are keyed for LibrarySource by the path a libs.Source lists them under.

Variables

This section is empty.

Functions

func Apply

func Apply(entry Entry, content []byte) ([]byte, error)

Apply returns content with the entry's correction substituted. It fails unless the declared line still reads as published, so a re-vendored corpus is a hard error rather than a silently skipped correction.

func ApplyAll

func ApplyAll(entries []Entry, content []byte) ([]byte, error)

ApplyAll is Apply for every entry of one file: each line is checked against its entry as published before any is substituted.

func Count

func Count(applied map[string][]Entry) int

Count returns how many entries an Under result holds.

func SortedPaths

func SortedPaths(applied map[string][]Entry) []string

SortedPaths returns the keys of an Under result in order.

Types

type Entry

type Entry struct {
	// ID is the entry's stable internal label, as the oracles report it.
	ID string
	// Heading titles the docs/project/omg-issues.md section documenting the
	// defect, without its `### ` marker.
	Heading string
	// Path is the defective file, relative to the repository root.
	Path string
	// Line is the 1-based line the entry covers.
	Line int
	// AsPublished is the published line, verbatim.
	AsPublished string
	// Corrected replaces AsPublished when non-empty. Empty means documented
	// without a correction: nothing is substituted, and the defect stands.
	Corrected string
	// Citation is the specification clause the published text violates.
	Citation string
	// Derivation states in one line why that clause is violated.
	Derivation string
}

Entry is one defect in published material. The span is one whole line: AsPublished is that line's exact bytes without its terminator, which is what lets a re-vendored corpus invalidate the entry instead of silently rotting it.

func LibraryEntries

func LibraryEntries() []Entry

LibraryEntries are the declared errata of the bundled standard library, in report order.

func (Entry) Corrects

func (e Entry) Corrects() bool

Corrects reports whether the entry substitutes text.

func (Entry) Validate

func (e Entry) Validate() error

Validate reports why an entry may not be accepted, short of where it lies: New checks the path against the published roots it is given.

type Overlay

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

Overlay is a registry indexed by file, ready to apply.

func Library

func Library() (*Overlay, error)

Library returns the bundled standard library's declared errata as an overlay.

func New

func New(published []string, entries []Entry) (*Overlay, error)

New validates entries and indexes them by path; each must lie under one of the published roots, the repository paths holding OMG-published material.

func (*Overlay) Corrections

func (o *Overlay) Corrections() []Entry

Corrections returns the entries that substitute text.

func (*Overlay) Documented

func (o *Overlay) Documented() []Entry

Documented returns the entries documented without a correction.

func (*Overlay) Entries

func (o *Overlay) Entries() []Entry

Entries returns every declared entry.

func (*Overlay) EntriesUnder

func (o *Overlay) EntriesUnder(dir string) map[string][]Entry

EntriesUnder is Under for every entry, the documented-only ones included, so a reader can verify each declared line and not only substitute the corrected.

func (*Overlay) LibrarySource

func (o *Overlay) LibrarySource(published Source) Source

LibrarySource serves the bundled standard library as published, with the corrections declared under LibraryRoot applied to the files they name. The published source is only ever read; a file whose declared line, corrected or documented only, no longer reads as published fails to load rather than loading unverified.

func (*Overlay) Under

func (o *Overlay) Under(dir string) map[string][]Entry

Under returns the correcting entries whose file lies under a repository path, keyed by the path relative to it, each file's entries in line order.

type Source

type Source interface {
	List() []string
	Read(name string) ([]byte, error)
}

Source is a library source in the shape of libs.Source: the relative paths of the files it serves, and their bytes.

Jump to

Keyboard shortcuts

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