Skip to content

Commit 4868bc7

Browse files
committed
Fix lint errors.
Signed-off-by: Jason Wells <spinmaster@gmail.com>
1 parent 43a23d5 commit 4868bc7

File tree

5 files changed

+22
-21
lines changed

5 files changed

+22
-21
lines changed

cmd/jiralert/main.go

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

25-
"github.com/andygrunwald/go-jira"
25+
jira "github.com/andygrunwald/go-jira"
2626

2727
"github.com/go-kit/kit/log"
2828
"github.com/go-kit/kit/log/level"

pkg/config/config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
"github.com/go-kit/kit/log/level"
2929

3030
"github.com/trivago/tgo/tcontainer"
31-
"gopkg.in/yaml.v2"
31+
yaml "gopkg.in/yaml.v2"
3232
)
3333

3434
// Secret is a string that must not be revealed on marshaling.
@@ -351,7 +351,7 @@ var durationRE = regexp.MustCompile("^([0-9]+)(y|w|d|h|m|s|ms)$")
351351
func ParseDuration(durationStr string) (Duration, error) {
352352
matches := durationRE.FindStringSubmatch(durationStr)
353353
if len(matches) != 3 {
354-
return 0, fmt.Errorf("not a valid duration string: %q", durationStr)
354+
return Duration(time.Duration(0)), fmt.Errorf("not a valid duration string: %q", durationStr)
355355
}
356356
var (
357357
n, _ = strconv.Atoi(matches[1])
@@ -373,7 +373,7 @@ func ParseDuration(durationStr string) (Duration, error) {
373373
case "ms":
374374
// Value already correct
375375
default:
376-
return 0, fmt.Errorf("invalid time unit in duration string: %q", unit)
376+
return Duration(time.Duration(0)), fmt.Errorf("invalid time unit in duration string: %q", unit)
377377
}
378378
return Duration(dur), nil
379379
}

pkg/config/config_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121

2222
"github.com/go-kit/kit/log"
2323
"github.com/stretchr/testify/require"
24-
"gopkg.in/yaml.v2"
24+
yaml "gopkg.in/yaml.v2"
2525
)
2626

2727
const testConf = `

pkg/notify/notify.go

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

24-
"github.com/andygrunwald/go-jira"
24+
jira "github.com/andygrunwald/go-jira"
2525
"github.com/go-kit/kit/log"
2626
"github.com/go-kit/kit/log/level"
2727
"github.com/pkg/errors"
@@ -164,6 +164,7 @@ func (r *Receiver) Notify(data *alertmanager.Data, hashJiraLabel bool) (bool, er
164164
if len(r.conf.Components) > 0 {
165165
issue.Fields.Components = make([]*jira.Component, 0, len(r.conf.Components))
166166
for _, component := range r.conf.Components {
167+
//nolint:typecheck // lint flags issueComp as not being used, even though it's referenced below.
167168
issueComp, err := r.tmpl.Execute(component, data)
168169
if err != nil {
169170
return false, errors.Wrap(err, "render issue component")

pkg/notify/notify_test.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121

2222
"github.com/trivago/tgo/tcontainer"
2323

24-
"github.com/andygrunwald/go-jira"
24+
jira "github.com/andygrunwald/go-jira"
2525
"github.com/go-kit/kit/log"
2626
"github.com/pkg/errors"
2727
"github.com/prometheus-community/jiralert/pkg/alertmanager"
@@ -203,9 +203,9 @@ func TestNotify_JIRAInteraction(t *testing.T) {
203203
initJira: func(t *testing.T) *fakeJira { return newTestFakeJira() },
204204
inputAlert: &alertmanager.Data{
205205
Alerts: alertmanager.Alerts{
206-
{Status: alertmanager.AlertFiring},
207-
{Status: "not firing"},
208-
{Status: alertmanager.AlertFiring},
206+
alertmanager.Alert{Status: alertmanager.AlertFiring},
207+
alertmanager.Alert{Status: "not firing"},
208+
alertmanager.Alert{Status: alertmanager.AlertFiring},
209209
},
210210
Status: alertmanager.AlertFiring,
211211
GroupLabels: alertmanager.KV{"a": "b", "c": "d"},
@@ -246,8 +246,8 @@ func TestNotify_JIRAInteraction(t *testing.T) {
246246
},
247247
inputAlert: &alertmanager.Data{
248248
Alerts: alertmanager.Alerts{
249-
{Status: "not firing"},
250-
{Status: alertmanager.AlertFiring}, // Only one firing now.
249+
alertmanager.Alert{Status: "not firing"},
250+
alertmanager.Alert{Status: alertmanager.AlertFiring}, // Only one firing now.
251251
},
252252
Status: alertmanager.AlertFiring,
253253
GroupLabels: alertmanager.KV{"a": "b", "c": "d"},
@@ -289,8 +289,8 @@ func TestNotify_JIRAInteraction(t *testing.T) {
289289
},
290290
inputAlert: &alertmanager.Data{
291291
Alerts: alertmanager.Alerts{
292-
{Status: "not firing"},
293-
{Status: alertmanager.AlertFiring}, // Only one firing now.
292+
alertmanager.Alert{Status: "not firing"},
293+
alertmanager.Alert{Status: alertmanager.AlertFiring}, // Only one firing now.
294294
},
295295
Status: alertmanager.AlertFiring,
296296
GroupLabels: alertmanager.KV{"a": "b", "c": "d"},
@@ -341,8 +341,8 @@ func TestNotify_JIRAInteraction(t *testing.T) {
341341
},
342342
inputAlert: &alertmanager.Data{
343343
Alerts: alertmanager.Alerts{
344-
{Status: "not firing"},
345-
{Status: alertmanager.AlertFiring}, // Only one firing now.
344+
alertmanager.Alert{Status: "not firing"},
345+
alertmanager.Alert{Status: alertmanager.AlertFiring}, // Only one firing now.
346346
},
347347
Status: alertmanager.AlertFiring,
348348
GroupLabels: alertmanager.KV{"a": "b", "c": "d"},
@@ -396,8 +396,8 @@ func TestNotify_JIRAInteraction(t *testing.T) {
396396
},
397397
inputAlert: &alertmanager.Data{
398398
Alerts: alertmanager.Alerts{
399-
{Status: "not firing"},
400-
{Status: alertmanager.AlertFiring}, // Only one firing now.
399+
alertmanager.Alert{Status: "not firing"},
400+
alertmanager.Alert{Status: alertmanager.AlertFiring}, // Only one firing now.
401401
},
402402
Status: alertmanager.AlertFiring,
403403
GroupLabels: alertmanager.KV{"a": "b", "c": "d"},
@@ -451,8 +451,8 @@ func TestNotify_JIRAInteraction(t *testing.T) {
451451
},
452452
inputAlert: &alertmanager.Data{
453453
Alerts: alertmanager.Alerts{
454-
{Status: "not firing"},
455-
{Status: alertmanager.AlertFiring}, // Only one firing now.
454+
alertmanager.Alert{Status: "not firing"},
455+
alertmanager.Alert{Status: alertmanager.AlertFiring}, // Only one firing now.
456456
},
457457
Status: alertmanager.AlertFiring,
458458
GroupLabels: alertmanager.KV{"a": "b", "c": "d"},
@@ -497,7 +497,7 @@ func TestNotify_JIRAInteraction(t *testing.T) {
497497
inputConfig: testReceiverConfigAutoResolve(),
498498
inputAlert: &alertmanager.Data{
499499
Alerts: alertmanager.Alerts{
500-
{Status: "resolved"},
500+
alertmanager.Alert{Status: "resolved"},
501501
},
502502
Status: alertmanager.AlertResolved,
503503
GroupLabels: alertmanager.KV{"a": "b", "c": "d"},

0 commit comments

Comments
 (0)