Check performs checks using c according to its configuration. An error is only returned if there is a configuration error.
()
| 52 | // Check performs checks using c according to its configuration. |
| 53 | // An error is only returned if there is a configuration error. |
| 54 | func (c Checker) Check() (types.Result, error) { |
| 55 | if c.Attempts < 1 { |
| 56 | c.Attempts = 1 |
| 57 | } |
| 58 | |
| 59 | result := types.NewResult() |
| 60 | result.Title = c.Name |
| 61 | result.Endpoint = c.URL |
| 62 | result.Times = c.doChecks() |
| 63 | |
| 64 | return c.conclude(result), nil |
| 65 | } |
| 66 | |
| 67 | // doChecks executes and returns each attempt. |
| 68 | func (c Checker) doChecks() types.Attempts { |