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 ¶
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 ¶
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.