func error_log(err error) { if err != nil { email.InitGmail(gmailAdress, gmailPassword) letter := email.NewBriefMessage("Parse error", fmt.Sprint(err), tomail) letter.Send() log.Fatal(err) } }
func main() { var gs GlobalSet flag.Parse() email.InitGmail(gmailAdress, gmailPassword) letter := email.NewBriefMessage("Start parse", "start", tomail) letter.Send() dropOldLinks() text, err := ioutil.ReadFile(settingsFile) err = json.Unmarshal(text, &gs) error_log(err) for _, v := range gs.Donors { wg.Add(1) go crawler(v) } wg.Wait() letter = email.NewBriefMessage("End parse", "No errors", tomail) letter.Send() }