String names the stop for diagnostics — telemetry attributes, log lines and test failure messages. Without it a MainLoopStop formats as a bare integer, which tells the reader nothing about which exit fired.
()
| 232 | // test failure messages. Without it a MainLoopStop formats as a bare integer, |
| 233 | // which tells the reader nothing about which exit fired. |
| 234 | func (s MainLoopStop) String() string { |
| 235 | switch s { |
| 236 | case StopNone: |
| 237 | return "none" |
| 238 | case StopMaxRounds: |
| 239 | return "max_rounds" |
| 240 | case StopEmptyRounds: |
| 241 | return "empty_rounds" |
| 242 | case StopCompression: |
| 243 | return "compression" |
| 244 | default: |
| 245 | return fmt.Sprintf("MainLoopStop(%d)", int(s)) |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | // Reason is the safe, human-facing sentence for a stop, and the single source of |
| 250 | // truth for it: the diff-review manifest reason and the scan subtask warning |
no outgoing calls