vectorio

package
v1.0.4 Latest Latest
Warning

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

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

Documentation

Overview

Package vectorio holds the byte semantics of a committed conformance corpus.

Every emitter writes a corpus the same way and compares it the same way, and the bytes are the contract: a corpus is committed, so an emitter that indented differently or dropped the trailing newline would rewrite the whole file and report the change as drift. Those semantics lived in one package's test files and were re-inlined by the emitter in another, because Go cannot reach a _test.go helper across a package boundary.

It deliberately takes no *testing.T and returns errors instead of failing. A non-test package that imports testing registers the -test.* flags on every binary that links it, so what is shared here is the byte handling; each emitter keeps its own t.Fatalf and its own wording.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(v any) ([]byte, error)

Marshal renders v the way every committed corpus is written: two-space indent and exactly one trailing newline.

func Stale

func Stale(path string, v any) (bool, error)

Stale reports whether the corpus committed at path differs from what v renders to. A corpus that cannot be read is stale rather than an error of its own: either way the emitter's answer is "regenerate", and the read error is returned alongside so the caller can say which it was.

func Write

func Write(path string, v any) error

Write replaces the corpus at path with v. Used only under FORA_UPDATE_VECTORS=1.

Types

This section is empty.

Jump to

Keyboard shortcuts

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