dolanor / rip

REST in peace

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Type Middleware as type alias

dolmen opened this issue · comments

For maximum flexibility type Middleware should be a type alias as it doesn't export any method.

as in

type Middleware = func(http.HandlerFunc) http.HandlerFunc

?

I guess I don't understand the difference in that specific case.

At runtime there will not be a specific type allocated. The availability of that specific named type is useless here as what matters is the func signature.

Check fmt.Printf("%T\n", Middleware(nil)).

Ok, got it.
Seems like a good idea. I'll get it done.