Skip to content
This repository has been archived by the owner on Jul 19, 2022. It is now read-only.

Commit

Permalink
fix golang-lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
betorvs committed Apr 6, 2021
1 parent efc885e commit 7ef5656
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -632,28 +632,31 @@ func titlePrettify(s string) string {
func updateAlert(alertClient *alert.Client, notes string, alertid string, details map[string]string) error {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
updateAlert := new(alert.AsyncAlertResult)
var err error
if len(details) != 0 {
updateAlert, err = alertClient.AddDetails(ctx, &alert.AddDetailsRequest{
// update with details and sensu source url
updateAlert, err := alertClient.AddDetails(ctx, &alert.AddDetailsRequest{
IdentifierType: alert.ALERTID,
IdentifierValue: alertid,
Source: source,
Note: notes,
Details: details,
})
if err != nil {
fmt.Printf("Not updated: %s \n", err)
}
fmt.Printf("RequestID with details %s to update %s \n", alertid, updateAlert.RequestId)
} else {
updateAlert, err = alertClient.AddNote(ctx, &alert.AddNoteRequest{
// update without details and just add check.output to notes
updateAlert, err := alertClient.AddNote(ctx, &alert.AddNoteRequest{
IdentifierType: alert.ALERTID,
IdentifierValue: alertid,
Source: source,
Note: notes,
})
if err != nil {
fmt.Printf("Not updated: %s \n", err)
}
fmt.Printf("RequestID %s to update %s \n", alertid, updateAlert.RequestId)
}
if err != nil {
fmt.Printf("Not updated: %s \n", err)
}
fmt.Printf("RequestID %s to update %s \n", alertid, updateAlert.RequestId)

return nil
}

0 comments on commit 7ef5656

Please sign in to comment.