@@ -2,6 +2,7 @@ package cmd
2
2
3
3
import (
4
4
"context"
5
+ "errors"
5
6
"fmt"
6
7
"strings"
7
8
"time"
@@ -19,7 +20,7 @@ var Timeout = 30
19
20
20
21
var rootCmd = & cobra.Command {
21
22
Use : "notify_zammad" ,
22
- PersistentPreRun : func (cmd * cobra.Command , args []string ) {
23
+ PersistentPreRun : func (_ * cobra.Command , _ []string ) {
23
24
go check .HandleTimeout (Timeout )
24
25
},
25
26
Short : "An Icinga notification plugin for Zammad" ,
@@ -110,7 +111,7 @@ func sendNotification(_ *cobra.Command, _ []string) {
110
111
notificationType , err := icingadsl .ParseNotificationType (cliConfig .IcingaNotificationType )
111
112
112
113
if err != nil {
113
- check .ExitError (fmt . Errorf ("unsupported notification type. Currently supported: Problem/Recovery/Acknowledgement" ))
114
+ check .ExitError (errors . New ("unsupported notification type. Currently supported: Problem/Recovery/Acknowledgement" ))
114
115
}
115
116
116
117
// Creating an client and connecting to the API
@@ -170,7 +171,7 @@ func sendNotification(_ *cobra.Command, _ []string) {
170
171
// If ticket exists, adds article to existing ticket
171
172
notificationErr = handleCustomNotification (ctx , c , ticket , "FlappingEnd" )
172
173
default :
173
- check .ExitError (fmt . Errorf ("unsupported notification type. Currently supported: Problem/Recovery/Acknowledgement" ))
174
+ check .ExitError (errors . New ("unsupported notification type. Currently supported: Problem/Recovery/Acknowledgement" ))
174
175
}
175
176
176
177
if notificationErr != nil {
@@ -229,10 +230,13 @@ func handleProblemNotification(ctx context.Context, c *client.Client, ticket zam
229
230
230
231
title .WriteString ("[Problem] " )
231
232
233
+ //nolint:perfsprint
232
234
title .WriteString (fmt .Sprintf ("State: %s for" , cliConfig .IcingaCheckState ))
235
+ //nolint:perfsprint
233
236
title .WriteString (fmt .Sprintf (" Host: %s" , cliConfig .IcingaHostname ))
234
237
235
238
if cliConfig .IcingaServiceName != "" {
239
+ //nolint:perfsprint
236
240
title .WriteString (fmt .Sprintf (" Service: %s" , cliConfig .IcingaServiceName ))
237
241
}
238
242
@@ -255,7 +259,7 @@ func handleAcknowledgeNotification(ctx context.Context, c *client.Client, ticket
255
259
// If no Zammad Ticket exists, we cannot add an article and thus return an error
256
260
// and notify the user
257
261
if ticket .ID == 0 {
258
- return fmt . Errorf ("no open or new ticket found to add acknowledgement article to" )
262
+ return errors . New ("no open or new ticket found to add acknowledgement article to" )
259
263
}
260
264
261
265
a := zammad.Article {
@@ -285,7 +289,7 @@ func handleAcknowledgeNotification(ctx context.Context, c *client.Client, ticket
285
289
// If ticket is closed, reopens the ticket with an article
286
290
func handleRecoveryNotification (ctx context.Context , c * client.Client , ticket zammad.Ticket ) error {
287
291
if ticket .ID == 0 {
288
- return fmt . Errorf ("no open or new ticket found to add recovery article to" )
292
+ return errors . New ("no open or new ticket found to add recovery article to" )
289
293
}
290
294
291
295
a := zammad.Article {
0 commit comments