Skip to content

Commit

Permalink
errcheck: check c.AddFunc return error.
Browse files Browse the repository at this point in the history
See,
cmd/mtr-exporter/main.go:53:11: Error return value of `c.AddFunc` is not checked(errcheck)
        c.AddFunc(*schedule, func() {
                 ^

Signed-off-by: Mario Trangoni <[email protected]>
  • Loading branch information
mjtrangoni authored and mgumz committed Dec 23, 2022
1 parent ec55527 commit a17e317
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/mtr-exporter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ func main() {
job := newMtrJob(*mtrBin, flag.Args())

c := cron.New()
c.AddFunc(*schedule, func() {

_, err := c.AddFunc(*schedule, func() {
log.Println("launching", job.cmdLine)
if err := job.Launch(); err != nil {
log.Println("failed:", err)
Expand All @@ -59,6 +60,11 @@ func main() {
log.Println("done: ",
len(job.Report.Hubs), "hops in", job.Duration, ".")
})
if err != nil {
log.Fatalf(err.Error())
os.Exit(1)
}

c.Start()

http.Handle("/metrics", job)
Expand Down

0 comments on commit a17e317

Please sign in to comment.