Skip to content

Commit 026d239

Browse files
Jason Wellstwotired
Jason Wells
authored andcommitted
Fix lint errors. (#127)
Signed-off-by: Jason Wells <[email protected]>
1 parent 8fdd24e commit 026d239

File tree

4 files changed

+24
-22
lines changed

4 files changed

+24
-22
lines changed

cmd/jiralert/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ import (
2222
"runtime"
2323
"strconv"
2424

25-
"github.com/andygrunwald/go-jira"
25+
jira "github.com/andygrunwald/go-jira"
26+
2627
"github.com/go-kit/log"
2728
"github.com/go-kit/log/level"
2829
"github.com/prometheus-community/jiralert/pkg/alertmanager"

pkg/config/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ var durationRE = regexp.MustCompile("^([0-9]+)(y|w|d|h|m|s|ms)$")
354354
func ParseDuration(durationStr string) (Duration, error) {
355355
matches := durationRE.FindStringSubmatch(durationStr)
356356
if len(matches) != 3 {
357-
return 0, fmt.Errorf("not a valid duration string: %q", durationStr)
357+
return Duration(time.Duration(0)), fmt.Errorf("not a valid duration string: %q", durationStr)
358358
}
359359
var (
360360
n, _ = strconv.Atoi(matches[1])
@@ -376,7 +376,7 @@ func ParseDuration(durationStr string) (Duration, error) {
376376
case "ms":
377377
// Value already correct
378378
default:
379-
return 0, fmt.Errorf("invalid time unit in duration string: %q", unit)
379+
return Duration(time.Duration(0)), fmt.Errorf("invalid time unit in duration string: %q", unit)
380380
}
381381
return Duration(dur), nil
382382
}

pkg/notify/notify.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"strings"
2323
"time"
2424

25-
"github.com/andygrunwald/go-jira"
25+
jira "github.com/andygrunwald/go-jira"
2626
"github.com/go-kit/log"
2727
"github.com/go-kit/log/level"
2828
"github.com/pkg/errors"
@@ -178,6 +178,7 @@ func (r *Receiver) Notify(data *alertmanager.Data, hashJiraLabel bool, updateSum
178178
if len(r.conf.Components) > 0 {
179179
issue.Fields.Components = make([]*jira.Component, 0, len(r.conf.Components))
180180
for _, component := range r.conf.Components {
181+
//nolint:typecheck // lint flags issueComp as not being used, even though it's referenced below.
181182
issueComp, err := r.tmpl.Execute(component, data)
182183
if err != nil {
183184
return false, errors.Wrap(err, "render issue component")

pkg/notify/notify_test.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
"testing"
2020
"time"
2121

22-
"github.com/andygrunwald/go-jira"
22+
jira "github.com/andygrunwald/go-jira"
2323

2424
"github.com/trivago/tgo/tcontainer"
2525

@@ -216,9 +216,9 @@ func TestNotify_JIRAInteraction(t *testing.T) {
216216
initJira: func(t *testing.T) *fakeJira { return newTestFakeJira() },
217217
inputAlert: &alertmanager.Data{
218218
Alerts: alertmanager.Alerts{
219-
{Status: alertmanager.AlertFiring},
220-
{Status: "not firing"},
221-
{Status: alertmanager.AlertFiring},
219+
alertmanager.Alert{Status: alertmanager.AlertFiring},
220+
alertmanager.Alert{Status: "not firing"},
221+
alertmanager.Alert{Status: alertmanager.AlertFiring},
222222
},
223223
Status: alertmanager.AlertFiring,
224224
GroupLabels: alertmanager.KV{"a": "b", "c": "d"},
@@ -259,8 +259,8 @@ func TestNotify_JIRAInteraction(t *testing.T) {
259259
},
260260
inputAlert: &alertmanager.Data{
261261
Alerts: alertmanager.Alerts{
262-
{Status: "not firing"},
263-
{Status: alertmanager.AlertFiring}, // Only one firing now.
262+
alertmanager.Alert{Status: "not firing"},
263+
alertmanager.Alert{Status: alertmanager.AlertFiring}, // Only one firing now.
264264
},
265265
Status: alertmanager.AlertFiring,
266266
GroupLabels: alertmanager.KV{"a": "b", "c": "d"},
@@ -302,8 +302,8 @@ func TestNotify_JIRAInteraction(t *testing.T) {
302302
},
303303
inputAlert: &alertmanager.Data{
304304
Alerts: alertmanager.Alerts{
305-
{Status: "not firing"},
306-
{Status: alertmanager.AlertFiring}, // Only one firing now.
305+
alertmanager.Alert{Status: "not firing"},
306+
alertmanager.Alert{Status: alertmanager.AlertFiring}, // Only one firing now.
307307
},
308308
Status: alertmanager.AlertFiring,
309309
GroupLabels: alertmanager.KV{"a": "b", "c": "d"},
@@ -354,8 +354,8 @@ func TestNotify_JIRAInteraction(t *testing.T) {
354354
},
355355
inputAlert: &alertmanager.Data{
356356
Alerts: alertmanager.Alerts{
357-
{Status: "not firing"},
358-
{Status: alertmanager.AlertFiring}, // Only one firing now.
357+
alertmanager.Alert{Status: "not firing"},
358+
alertmanager.Alert{Status: alertmanager.AlertFiring}, // Only one firing now.
359359
},
360360
Status: alertmanager.AlertFiring,
361361
GroupLabels: alertmanager.KV{"a": "b", "c": "d"},
@@ -409,8 +409,8 @@ func TestNotify_JIRAInteraction(t *testing.T) {
409409
},
410410
inputAlert: &alertmanager.Data{
411411
Alerts: alertmanager.Alerts{
412-
{Status: "not firing"},
413-
{Status: alertmanager.AlertFiring}, // Only one firing now.
412+
alertmanager.Alert{Status: "not firing"},
413+
alertmanager.Alert{Status: alertmanager.AlertFiring}, // Only one firing now.
414414
},
415415
Status: alertmanager.AlertFiring,
416416
GroupLabels: alertmanager.KV{"a": "b", "c": "d"},
@@ -464,8 +464,8 @@ func TestNotify_JIRAInteraction(t *testing.T) {
464464
},
465465
inputAlert: &alertmanager.Data{
466466
Alerts: alertmanager.Alerts{
467-
{Status: "not firing"},
468-
{Status: alertmanager.AlertFiring}, // Only one firing now.
467+
alertmanager.Alert{Status: "not firing"},
468+
alertmanager.Alert{Status: alertmanager.AlertFiring}, // Only one firing now.
469469
},
470470
Status: alertmanager.AlertFiring,
471471
GroupLabels: alertmanager.KV{"a": "b", "c": "d"},
@@ -510,7 +510,7 @@ func TestNotify_JIRAInteraction(t *testing.T) {
510510
inputConfig: testReceiverConfigAutoResolve(),
511511
inputAlert: &alertmanager.Data{
512512
Alerts: alertmanager.Alerts{
513-
{Status: "resolved"},
513+
alertmanager.Alert{Status: "resolved"},
514514
},
515515
Status: alertmanager.AlertResolved,
516516
GroupLabels: alertmanager.KV{"a": "b", "c": "d"},
@@ -554,9 +554,9 @@ func TestNotify_JIRAInteraction(t *testing.T) {
554554
initJira: func(t *testing.T) *fakeJira { return newTestFakeJira() },
555555
inputAlert: &alertmanager.Data{
556556
Alerts: alertmanager.Alerts{
557-
{Status: alertmanager.AlertFiring},
558-
{Status: "not firing"},
559-
{Status: alertmanager.AlertFiring},
557+
alertmanager.Alert{Status: alertmanager.AlertFiring},
558+
alertmanager.Alert{Status: "not firing"},
559+
alertmanager.Alert{Status: alertmanager.AlertFiring},
560560
},
561561
Status: alertmanager.AlertFiring,
562562
GroupLabels: alertmanager.KV{"a": "b", "c": "d"},

0 commit comments

Comments
 (0)