有时候需要往浏览器访问的页面中输出调试信息,可以使用以下方法
import (
    "fmt"
    "html/template"
    "io"
    "log"
    "net/http"
)
func writeHandler(w http.ResponseWriter, r *http.Request) {
    w.Write([]byte("hello"))
    io.WriteString(w, "hello io.writestring")
    fmt.Fprintf(w, "abc")
    return
}

 


posted on 2015-03-04 13:32  浊浊然  阅读(1384)  评论(0编辑  收藏  举报