package check import ( "fmt" "mesh-delivery-checker/rules" ) // A change that adds or modifies a compiled program fails (issue 1577): it is build output, `go build` in a module's folder // writes one beside go.mod, and `git add -A` takes it. The build module's fetch step, which holds the merged clone, reads the // first bytes of each changed file and reports the programs (the build modules' fetch tools); the checker judges the answer. // checkBinariesOf records what a pull request's first fetch answer read of compiled programs, whichever build module // gave it, as a fact the rules judge (rules.JudgePrograms). A fetch that made the merge and names no program has none: the // answer's `programs` is an omitted empty list (B2g), and `merge` tells a preview was made. func (st *state) checkBinariesOf(t *target) { key := fmt.Sprintf("%s#%d", t.pull.Repository, t.pull.Number) if t.fetched.Merge == "" { return // no merge was made: nothing was changed to judge } files := t.fetched.Programs if files == nil { files = []ProgramFile{} // reported, and none: the rules refuse nothing (a nil list is a module that reports none) } st.facts = append(st.facts, rules.Step{Repository: t.pull.Repository, Number: t.pull.Number, Module: t.module, Node: t.node, Programs: &rules.Programs{Key: key, Files: &files}}) }