Documentation
¶
Overview ¶
Package verify runs the gate of an application and reports one record for each step, S16.
`avero verify --json` emits the report, and the MCP tool run_verify returns the same document. The order of the records is the order of the gate, so two runs on one tree give the same order. See AN-3 and AN-4.
Index ¶
Constants ¶
const ( // StatusPass marks a step that holds. StatusPass = "pass" // StatusFail marks a step that does not hold. StatusFail = "fail" )
The status of one record.
const SchemaID = "https://avero.dev/schema/verify-report/v1"
SchemaID names the schema that a JSON verify report follows. See verify/schema.json.
Variables ¶
var Schema []byte
Schema holds verify/schema.json. `avero verify --json` emits a document that this schema accepts. See AN-3.
Functions ¶
Types ¶
type Record ¶
type Record struct {
// Name names the step, such as gofmt.
Name string `json:"name"`
// Status is pass or fail.
Status string `json:"status"`
// DurationMS is the time of the step in milliseconds.
DurationMS int64 `json:"duration_ms"`
// Message states the fault. It is empty for a step that passes.
Message string `json:"message"`
// File names the file that holds the fault, or the empty string.
File string `json:"file"`
// Line names the line that holds the fault, or zero.
Line int `json:"line"`
// Column names the column that holds the fault, or zero.
Column int `json:"column"`
}
Record is one step of the gate.
type Report ¶
type Report struct {
// OK reports a report with no failed step.
OK bool `json:"ok"`
// Records holds one row for each step, in the order of the gate. See
// AN-4.
Records []Record `json:"records"`
}
Report is the answer of the gate.
func Run ¶
Run performs the gate in dir and returns the report. It returns no error for a failed step, because the report states the failure.
func (*Report) MarshalJSON ¶
MarshalJSON emits the report with a stable schema. See AN-3.
type Step ¶
type Step struct {
// Name names the step.
Name string
// Args is the command line, with the program first.
Args []string
// Run performs a step that runs no command. It returns the fault, or
// nil.
Run func(dir string) error
// AcceptOutput reports a step that fails when it writes output, although
// it exits with the code zero. gofmt is such a step.
AcceptOutput bool
}
Step is one command of the gate. A step with no command runs the function that Run holds for it, so the generated files are proven in this process and the application needs no dependency on the avero binary.