func main() {
	db, err := run()
	if err != nil {
		log.Fatal(err)
	}
	defer db.Conn.Close()

	defer close(app.MailChan)
	log.Println("Starting mail listener")
	listenForMail()

	log.Printf("Starting application on port %s\n", portNumber)

	srv := &http.Server{
		Addr:    portNumber,
		Handler: routes(&app),
	}

	err = srv.ListenAndServe()
	log.Fatal(err)
}
// main is the main application function
main is the main application function
// main is the main application function
func main() {
	db, err := run()
	if err != nil {
		log.Fatal(err)
	}
	defer db.Conn.Close()
	defer close(app.MailChan)
	log.Println("Starting mail listener")
	listenForMail()
	log.Printf("Starting application on port %s\n", portNumber)
	srv := &http.Server{
		Addr:    portNumber,
		Handler: routes(&app),
	}
	err = srv.ListenAndServe()
	log.Fatal(err)
}
func main ( ) { db , err := run ( ) if err != nil { log . Fatal ( err ) } defer db . Conn . Close ( ) defer close ( app . MailChan ) log . Println ( " " ) listenForMail ( ) log . Printf ( " \n " , portNumber ) srv := & http . Server { Addr : portNumber , Handler : routes ( & app ) , } err = srv . ListenAndServe ( ) log . Fatal ( err ) }
main is the main application function
main is the main application function