Skip to content

Commit

Permalink
drop else branch
Browse files Browse the repository at this point in the history
  • Loading branch information
mmetc committed May 17, 2024
1 parent 90a4739 commit 79a8675
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions pkg/models/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,15 @@ func (a *Alert) FormatAsStrings(machineID string, logger *log.Logger) []string {
reason = fmt.Sprintf("%s for %d/%d decisions", msg, i+1, len(a.Decisions))
}

var machineIDOrigin string
if machineID == "" {
machineIDOrigin = *decisionItem.Origin
} else {
machineIDOrigin = fmt.Sprintf("%s/%s", machineID, *decisionItem.Origin)
origin := *decisionItem.Origin
if machineID != "" {
origin = machineID + "/" + origin
}

decision += fmt.Sprintf("%s %s on %s %s", *decisionItem.Duration,
*decisionItem.Type, *decisionItem.Scope, *decisionItem.Value)
retStr = append(retStr,
fmt.Sprintf("(%s) %s : %s", machineIDOrigin, reason, decision))
fmt.Sprintf("(%s) %s : %s", origin, reason, decision))
}

return retStr
Expand Down

0 comments on commit 79a8675

Please sign in to comment.