Skip to content

Commit 38c2e1c

Browse files
authored
Merge pull request #19 from NETWAYS/bumpgo
Bump Go in build to 1.23
2 parents bbe8913 + 9888ffc commit 38c2e1c

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

.github/workflows/build.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Set up Go
2020
uses: actions/setup-go@v5
2121
with:
22-
go-version: 1.21
22+
go-version: 1.23
2323

2424
- name: Test
2525
run: go test -v ./...
@@ -32,6 +32,6 @@ jobs:
3232
uses: goreleaser/goreleaser-action@v6
3333
with:
3434
version: latest
35-
args: release --rm-dist
35+
args: release --clean
3636
env:
3737
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/golangci-lint.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ jobs:
1717
- name: golangci-lint
1818
uses: golangci/golangci-lint-action@v6
1919
with:
20-
version: v1.55
20+
version: v1.61

.golangci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ linters:
2626
- goerr113
2727
- gofumpt
2828
- gomnd
29+
- mnd
2930
- lll
3031
- musttag
3132
- nakedret

cmd/root.go

+9-5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package cmd
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67
"strings"
78
"time"
@@ -19,7 +20,7 @@ var Timeout = 30
1920

2021
var rootCmd = &cobra.Command{
2122
Use: "notify_zammad",
22-
PersistentPreRun: func(cmd *cobra.Command, args []string) {
23+
PersistentPreRun: func(_ *cobra.Command, _ []string) {
2324
go check.HandleTimeout(Timeout)
2425
},
2526
Short: "An Icinga notification plugin for Zammad",
@@ -110,7 +111,7 @@ func sendNotification(_ *cobra.Command, _ []string) {
110111
notificationType, err := icingadsl.ParseNotificationType(cliConfig.IcingaNotificationType)
111112

112113
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"))
114115
}
115116

116117
// Creating an client and connecting to the API
@@ -170,7 +171,7 @@ func sendNotification(_ *cobra.Command, _ []string) {
170171
// If ticket exists, adds article to existing ticket
171172
notificationErr = handleCustomNotification(ctx, c, ticket, "FlappingEnd")
172173
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"))
174175
}
175176

176177
if notificationErr != nil {
@@ -229,10 +230,13 @@ func handleProblemNotification(ctx context.Context, c *client.Client, ticket zam
229230

230231
title.WriteString("[Problem] ")
231232

233+
//nolint:perfsprint
232234
title.WriteString(fmt.Sprintf("State: %s for", cliConfig.IcingaCheckState))
235+
//nolint:perfsprint
233236
title.WriteString(fmt.Sprintf(" Host: %s", cliConfig.IcingaHostname))
234237

235238
if cliConfig.IcingaServiceName != "" {
239+
//nolint:perfsprint
236240
title.WriteString(fmt.Sprintf(" Service: %s", cliConfig.IcingaServiceName))
237241
}
238242

@@ -255,7 +259,7 @@ func handleAcknowledgeNotification(ctx context.Context, c *client.Client, ticket
255259
// If no Zammad Ticket exists, we cannot add an article and thus return an error
256260
// and notify the user
257261
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")
259263
}
260264

261265
a := zammad.Article{
@@ -285,7 +289,7 @@ func handleAcknowledgeNotification(ctx context.Context, c *client.Client, ticket
285289
// If ticket is closed, reopens the ticket with an article
286290
func handleRecoveryNotification(ctx context.Context, c *client.Client, ticket zammad.Ticket) error {
287291
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")
289293
}
290294

291295
a := zammad.Article{

0 commit comments

Comments
 (0)