func Handler(gf GoannaHandlerFunc) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		gr := &Request{Request: r}
		gf(gr).Send(w)
	}
}
Handler handles functions of type GoannaHandlerFunc
package goanna
import (
	"fmt"
	"net/http"
	"reflect"
	"github.com/gorilla/mux"
)
type ControllerFactoryFunc func() ControllerInterface
type ControllerHandler struct {
	factory    ControllerFactoryFunc
	methodName string
}
func (handler ControllerHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	handler.getResponse(r).Send(w)
}
func (handler ControllerHandler) getResponse(r *http.Request) Response {
	controller := handler.factory()
	controller.SetRequest(r)
	controller.Init()
	rController := reflect.ValueOf(controller)
	method := rController.MethodByName(handler.methodName)
	var args []reflect.Value
	for _, val := range mux.Vars(r) {
		args = append(args, reflect.ValueOf(val))
	}
	expected := len(args)
	actual := method.Type().NumIn()
	if expected != actual {
		panic(fmt.Sprintf("Method '%s' has %d args, expected %d", handler.methodName, actual, expected))
	}
	out := method.Call(args)
	if out[0].IsNil() {
		panic("Response from controller was nil")
	}
	resp := out[0].Interface().(Response)
	if resp == nil {
		panic("Response from controller was not Response interface")
	}
	controller.Session().WriteToResponse(resp)
	return resp
}
func (handler ControllerHandler) isValid() bool {
	controller := handler.factory()
	rController := reflect.ValueOf(controller)
	method := rController.MethodByName(handler.methodName)
	if (method == reflect.Value{}) {
		panic("No such method: " + handler.methodName)
	}
	typeOfMethod := method.Type()
	var r *Response
	responseType := reflect.TypeOf(r).Elem()
	return (method.Kind() == reflect.Func) &&
		(typeOfMethod.NumMethod() == 0) &&
		(typeOfMethod.NumOut() == 1) &&
		typeOfMethod.Out(0) == responseType
}
func NewHandler(factory ControllerFactoryFunc, methodName string) ControllerHandler {
	handler := ControllerHandler{factory: factory, methodName: methodName}
	if !handler.isValid() {
		panic("Invalid handler: " + methodName)
	}
	return handler
}
type GoannaHandlerFunc func(r *Request) Response