Simple Golang app running under CGI, borrowed from http://golang-examples.tumblr.com/post/102922043369/simple-cgi-app
func errorResponse(code int, msg string) {
fmt.Printf("Status: %d %s\r\n", code, msg)
fmt.Printf("Content-Type: text/plain\r\n")
fmt.Printf("\r\n")
fmt.Printf("%s\r\n", msg)
}
func main() {
req, err := cgi.Request()
if err != nil {
errorResponse(500, "cannot get cgi request" + err.Error())
}
fmt.Printf("Content-Type: text/plain\r\n")
fmt.Printf("\r\n")
fmt.Printf("req=%v\r\n", req)
fmt.Printf("body=%v\r\n", req.Body)
}