doucai7294 2014-09-15 23:04
浏览 33
已采纳

返回字符串作为模板

I would like to return a string as a template in martini in golang :

m.Get("/", func(r render.Render) string {
    template := "Hello world! <form name='input' action='../first' method='post' ><input type='texte' name='toto'><input type='submit' value='Submit'></form>"
    r.HTML(200, "post", template)

})

but it return me an error : missing return at end of function

Regards & thanks bussiere

  • 写回答

3条回答 默认 最新

  • doutiao2540 2014-09-15 23:06
    关注

    You need to return the string so:

    m.Get("/", func(r render.Render) string {
        return "Hello world! <form name='input' action='../first' method='post' ><input type='texte' name='toto'><input type='submit' value='Submit'></form>"
    })
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?