printReport writes what each binary did. With more than one binary, it then lists how each one differs from the first. notes say which schema checks couldn't run.
(w io.Writer, opts runOptions, results []runResult, notes []string)
| 18 | // lists how each one differs from the first. notes say which schema checks |
| 19 | // couldn't run. |
| 20 | func printReport(w io.Writer, opts runOptions, results []runResult, notes []string) { |
| 21 | quoted := make([]string, len(opts.args)) |
| 22 | for i, arg := range opts.args { |
| 23 | quoted[i] = shellQuote(arg) |
| 24 | } |
| 25 | command := "$ gh " + strings.Join(quoted, " ") |
| 26 | if len(results) == 1 { |
| 27 | fmt.Fprintf(w, "%s - %s\n", results[0].version, results[0].path) |
| 28 | printResult(w, command, results[0]) |
| 29 | printNotes(w, notes) |
| 30 | return |
| 31 | } |
| 32 | |
| 33 | for i, res := range results { |
| 34 | suffix := "" |
| 35 | if i == 0 { |
| 36 | suffix = " (baseline)" |
| 37 | } |
| 38 | fmt.Fprintf(w, "=== [%d] %s - %s%s\n", i+1, res.version, res.path, suffix) |
| 39 | printResult(w, command, res) |
| 40 | fmt.Fprintln(w) |
| 41 | } |
| 42 | |
| 43 | fmt.Fprintln(w, "=== differences from [1]") |
| 44 | for i := 1; i < len(results); i++ { |
| 45 | printDifferences(w, results[0], results[i], i+1) |
| 46 | } |
| 47 | printNotes(w, notes) |
| 48 | } |
| 49 | |
| 50 | func printNotes(w io.Writer, notes []string) { |
| 51 | if len(notes) == 0 { |