/////////////////////////////////////////////// //serve some text and an image package main import ( "net/http" "time" "math/rand" "fmt" ) var text = "<h1>Hi there %s!<br> The time is: %s.<br> Random number of the day: %d</h1>" var image = "<img src='https://dl.dropboxusercontent.com/u/7632896/m_Lp_lorez.png'>" func main() { http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, text, r.URL.Path[1:], time.Now(), rand.Intn(100)) fmt.Fprintf(w, image) }) http.ListenAndServe(":9000", nil) }