Exit non-zero when any errors are logged during bootstrap run
Track error count in issues.go alongside the existing issues slice. Add hasErrors() helper. In main.go, call osExit(1) after writeRunLog() if any [ERROR] entries were recorded, so CI steps correctly fail when errors occur (e.g. GitHub API 403 rate-limit hits in the macOS job). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -13,9 +13,10 @@ import (
|
||||
// when there's something to report.
|
||||
|
||||
var (
|
||||
issuesMu sync.Mutex
|
||||
issues []string
|
||||
notices []string
|
||||
issuesMu sync.Mutex
|
||||
issues []string
|
||||
notices []string
|
||||
errorCount int
|
||||
)
|
||||
|
||||
func logIssue(level, msg string) {
|
||||
@@ -23,11 +24,20 @@ func logIssue(level, msg string) {
|
||||
defer issuesMu.Unlock()
|
||||
fmt.Printf(" [%s] %s\n", level, msg)
|
||||
issues = append(issues, fmt.Sprintf("[%s] %s", level, msg))
|
||||
if level == "ERROR" {
|
||||
errorCount++
|
||||
}
|
||||
}
|
||||
|
||||
func warn(msg string) { logIssue("WARN", msg) }
|
||||
func errLog(msg string) { logIssue("ERROR", msg) }
|
||||
|
||||
func hasErrors() bool {
|
||||
issuesMu.Lock()
|
||||
defer issuesMu.Unlock()
|
||||
return errorCount > 0
|
||||
}
|
||||
|
||||
func notice(msg string) {
|
||||
issuesMu.Lock()
|
||||
defer issuesMu.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user