Documentation
¶
Overview ¶
Package priorledger records the runs of priorart, so that the act priorart is meant to precede can ask whether it did.
priorart (#193) answers "has this already been done?" for whoever runs it. Nothing tied that answer to the act of filing: twice in two days (go-gitsafe/gitsafe#99, a duplicate of go-gitsafe/gitsafe#90 that go-gitsafe/gitsafe#96 was already implementing; then go-quake1/engine#88) priorart and `ghissue --new` ran in ONE shell command, so its verdict -- exit 1, "found" -- arrived after the issue existed. A check in the same command as the act it guards is a log, not a gate. ghissue now asks this ledger instead.
The ledger is append-only JSON lines under the user's cache directory, the directory 0700 and the file 0600: it names repositories and subjects, which are not secret, but nothing else on the machine needs to write it. It is bounded: past MaxBytes it keeps its most recent half.
Index ¶
Constants ¶
const ( None = 0 // read every surface, found nothing Found = 1 // found prior art Gap = 2 // a surface could not be read, or the question could not be put )
Verdicts, as priorart exits.
const MaxBytes = 1 << 20
MaxBytes bounds the ledger file.
Variables ¶
var ErrNone = errors.New("no priorart run covers this repository")
ErrNone is returned by Latest when no run covers the repository in time.
var Path = func() (string, error) { dir, err := os.UserCacheDir() if err != nil { return "", err } return filepath.Join(dir, "fleettools", "priorart.jsonl"), nil }
Path is the ledger file; tests point it elsewhere.
Functions ¶
Types ¶
type Record ¶
type Record struct {
Time time.Time `json:"time"`
Repos []string `json:"repos,omitempty"` // --repo owner/name, lower-cased
Org string `json:"org,omitempty"` // --org name, lower-cased
Subject string `json:"subject"`
Verdict int `json:"verdict"`
}
Record is one priorart run.