vectors

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: Apache-2.0 Imports: 8 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 vectors is an application's golden-vector command: it writes the files the application's codec generates under a directory, or with -check compares them byte for byte and writes nothing. An application's cmd/vectors is one call:

func main() {
	files, err := vectors.Generate() // the application's own generator
	os.Exit(devvectors.Main(os.Args[1:], files, err, devvectors.Options{}, os.Stderr))
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Main

func Main(args []string, files map[string][]byte, genErr error, o Options, stderr io.Writer) int

Main runs the command on args (without the program name): -dir DIR and -check. files is what the generator made, and genErr its failure. It returns the exit status: 0, 1 when a file differs, is missing or could not be written, or the generator failed, 2 for a usage error.

func Run

func Run(dir string, files map[string][]byte, check, strict bool) ([]string, error)

Run writes files into dir, or with check compares them with what is there and returns a line per difference ("differs: <path>", and with strict "not generated: <path>" for a *.json file nothing generates). An error is a file that could not be written or a directory that could not be read.

Types

type Options

type Options struct {
	// Dir is the default vector directory; empty is testdata/vectors.
	Dir string
	// Strict makes -check also refuse a *.json file in the directory that
	// nothing generates: a vector the codec dropped is stale too.
	Strict bool
}

Options are what differ between applications.

Jump to

Keyboard shortcuts

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