News for hackers. Stuff that matters.
Re:"100% of our production system is now running Go" by tocomment on Friday August 31, 2012 @09:46AM (#4459655)
Thanks! That's exactly what I was trying to figure out. You're a gem.

So is there anywhere I can see an example of code that runs a server like this?

Re:"100% of our production system is now running Go" by eckyptang on Friday August 31, 2012 @09:51AM (#4459674)
From the tour - I've added comments for clarity:

   // this defines the entry point
   package main
   
   // import formatting and HTTP server packages
   import (
   	"fmt"
   	"net/http"
   )

   // This is your HTTP Server instance
   type Hello struct{}
   
   // This is a method on your HTTP server instance that sends hello for all requests
   func (h Hello) ServeHTTP(
   		w http.ResponseWriter,
   		r *http.Request) {
   	fmt.Fprint(w, "Hello!")
   }
   
   // this is your entry point
   func main() {
        // create a new HTTP Server instance
   	var h Hello
        // tell the runtime to serve it
   	http.ListenAndServe("localhost:4000",h)
   }