package main import ( "fmt" "html/template" "io/ioutil" "log" "net/http" ) type liveCast struct { Youtube string Title string Description string } func liveCastHandler(w http.ResponseWriter, r *http.Request) { cast := liveCast{} cast.Youtube = "https://www.youtube.com/embed/T3-ueqivO0g" cast.Title = "大学联盟活动日" cast.Description = ` 当地时间7月12日,伊利诺伊州中部地区联邦检察官办公室发布公告称,综合各种证据,负责调查案件的执法人员相信章莹颖已经死亡。   美国司法部网站12日发布消息,美国联邦大陪审团当天正式起诉涉嫌绑架中国访问学者章莹颖的嫌疑人布伦特·克里斯滕森(Brendt Christensen),原定14日进行的预审取消,提审日期待定。   如罪名成立,嫌疑人布伦特·克里斯滕森将面临终身监禁的最高刑罚。目前美国警方仍在就此案进行调查。   伊利诺伊州乌尔班纳(Urbana)的一个联邦大陪审团星期三决定起诉涉嫌绑架中国学者章莹颖的一名男子。` cast.youtubeVideo(w, r) } func (m liveCast) youtubeVideo(w http.ResponseWriter, r *http.Request) { tTest := template.New("livecast") str, err := ioutil.ReadFile("spa/livecast.html") if err != nil { w.WriteHeader(http.StatusInternalServerError) fmt.Fprintf(w, "Formating information not available.") return } tTest, err = tTest.Parse(string(str)) if err != nil { w.WriteHeader(http.StatusInternalServerError) fmt.Fprintf(w, "Formating instruction invalid") return } err = tTest.Execute(w, m) if err != nil { w.WriteHeader(http.StatusInternalServerError) fmt.Fprintf(w, "Monkey runs into our computer room...") log.Println("ERROR: Template execution on spa/Edit, failed \n" + err.Error()) } }