func writeLoop(bookid, tabid string, noteids []string) { for i := 0; i < 10; i++ { note := new(d.Note) note.Id = noteids[rand.Intn(len(noteids))] note.Content = "changed Note " + note.Id note.When = time.Now() note.Html = true note.Mono = false noteParms := d.NoteParms{Bookid: bookid, Tabid: tabid, Note: note} resultChan := d.Data("changeNote", ¬eParms) if result := <-resultChan; result.Status != d.DataOk { log.Fatal(result.Val.(string)) } } doneChan <- "writeLoop done" }