Skip to content

Commit

Permalink
Removing unnecessary event check from main.go. These checks are alrea…
Browse files Browse the repository at this point in the history
…dy being performed in sensu-plugins-go-library
  • Loading branch information
sayakghosh committed May 16, 2019
1 parent 0f37d31 commit 67fcc2e
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,31 +82,11 @@ func main() {
}
}

func checkArgs(event *types.Event) error {
func checkArgs(_ *types.Event) error {
if len(config.SlackWebhookUrl.Value) == 0 {
return fmt.Errorf("--webhook-url or SENSU_SLACK_WEHBOOK_URL environment variable is required")
}

if event.Timestamp <= 0 {
return errors.New("timestamp is missing or must be greater than zero")
}

if event.Entity == nil {
return errors.New("entity is missing from event")
}

if !event.HasCheck() {
return errors.New("check is missing from event")
}

if err := event.Entity.Validate(); err != nil {
return err
}

if err := event.Check.Validate(); err != nil {
return err
}

return nil
}

Expand Down

0 comments on commit 67fcc2e

Please sign in to comment.