go channels syntax and timing
I have the following (generated) code that works but I dont really understand what happens in its last statement messages := make(chan *imap.Message, count) done := make(chan error, 1) go func() { done <- c.Fetch(seqset, items, messages) }() for msg := range messages { r := msg.GetBody(section) if r == nil { continue } m, err := mail.ReadMessage(r) if err != nil { log.Println("parse error:", err) continue } body, err := io.ReadAll(m.Body) if err != nil { log.Println("read body error:", err) continue } fmt.Println("========================================") fmt.Println("From: ", m.Header.Get("F
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.