包 http 通过任何实现了 http.Handler 的值来响应 HTTP 请求:
package http
type Handler interface {
	ServeHTTP(w ResponseWriter,
	          r *Request)
}
在这个例子中,类型 Hello 实现了 http.Handler。
注意: 这个例子无法在基于 web 的指南用户界面运行。为了尝试编写 web 服务器,可能需要安装 Go。
package main
import (
	"fmt"
	"net/http"
)
type Hello struct{}
func (h Hello) ServeHTTP(
		w http.ResponseWriter,
		r *http.Request) {
	fmt.Fprint(w, "Hello!")
}
func main() {
	var h Hello
	http.ListenAndServe("localhost:4000",h)
}
