fix: lazysecrets list keeps each entry on one line, errors to their first
This commit is contained in:
3 files changed
+29
-2
No files matched your search
@@ -312,10 +312,22 @@ func (r result) failed() Entry {
|
||||
default:
|
||||
e = Entry{Kind: "source", Provider: kindOf(r.p.Kind()), Path: []string{r.p.Label()}}
|
||||
}
|
||||
e.Error = r.err.Error()
|
||||
e.Error = firstLine(r.err.Error())
|
||||
return e
|
||||
}
|
||||
|
||||
// firstLine is an error's first line, the summary (Azure's go on with
|
||||
// the caller's IDs and more): an entry is one line. Tabs, which would
|
||||
// split it into columns, are spaces.
|
||||
func firstLine(s string) string {
|
||||
for line := range strings.Lines(s) {
|
||||
if line = strings.TrimSpace(line); line != "" {
|
||||
return strings.ReplaceAll(line, "\t", " ")
|
||||
}
|
||||
}
|
||||
return "unreadable"
|
||||
}
|
||||
|
||||
func kindOf(k provider.Kind) string { return strings.ToLower(string(k)) }
|
||||
|
||||
// accountOf is the account part of a source's provider label ("alice" in
|
||||
|
||||
Reference in new issue
Block a user