type Message struct {
Time time.Time
+ ID string
Text string
}
})
http.HandleFunc("/speak", func(w http.ResponseWriter, r *http.Request) {
- store.Add <- &Message{time.Now(), r.FormValue("text")}
+ store.Add <- &Message{
+ time.Now(),
+ r.FormValue("id"),
+ r.FormValue("text")}
})
- log.Fatal(http.ListenAndServe(":" + strconv.Itoa(*port), nil))
+ log.Fatal(http.ListenAndServe(":"+strconv.Itoa(*port), nil))
}
func main() {