Log when no URLs are found
Anirudh Oppiliappan x@icyphox.sh
Thu, 16 Sep 2021 21:34:11 +0530
1 files changed,
5 insertions(+),
1 deletions(-)
jump to
M
main.go
→
main.go
@@ -20,7 +20,11 @@ if err != nil {
log.Println(err) } - for _, u := range distinct(mail.ExtractURLs(body)) { + urls := mail.ExtractURLs(body) + if len(urls) == 0 { + log.Printf("no urls found") + } + for _, u := range distinct(urls) { log.Printf("url: %s\n", u) parsedURL, err := url.Parse(u) if err != nil {