Skip to content

Commit

Permalink
test(lint): Fix lint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Apr 30, 2024
1 parent 20fe714 commit 5b52f00
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ go 1.22.2

require (
github.com/aws/aws-lambda-go v1.47.0
github.com/davecgh/go-spew v1.1.1
github.com/slack-go/slack v0.12.5
github.com/spf13/cobra v1.8.0
github.com/spf13/pflag v1.0.5
Expand All @@ -13,6 +12,7 @@ require (
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/kr/pretty v0.3.0 // indirect
Expand Down
1 change: 1 addition & 0 deletions internal/alert/slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ func (event Event) ContextMsg() string {

switch event.AlarmData.State.Value {
case StateAlarm, StateInsufficientData:
//nolint:gosmopolitan
context += "\n*Started at:* _" + event.AlarmData.State.Timestamp.Local().Format("3:04:05 PM") + "_"
case StateOK:
context += "\n*Duration:* " + event.AlarmData.State.Timestamp.Sub(event.AlarmData.PreviousState.Timestamp.Time).Round(time.Second).String()
Expand Down
5 changes: 4 additions & 1 deletion internal/alert/time.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package alert

import (
"errors"
"fmt"
"time"
)

Expand All @@ -11,9 +12,11 @@ type Time struct {
time.Time
}

var ErrTimeInvalidInput = errors.New("Time.UnmarshalJSON: input is not JSON")

func (t *Time) UnmarshalJSON(data []byte) error {
if len(data) < 2 || data[0] != '"' || data[len(data)-1] != '"' {
return errors.New("Time.UnmarshalJSON: input is not a JSON string")
return fmt.Errorf("%w: %q", ErrTimeInvalidInput, data)
}
data = data[len(`"`) : len(data)-len(`"`)]
var err error
Expand Down

0 comments on commit 5b52f00

Please sign in to comment.