dolanor / rip

REST in peace
BSD 3-Clause "New" or "Revised" License
68 stars 0 forks source link

Type Middleware as type alias #4

Closed dolmen closed 7 months ago

dolmen commented 8 months ago

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

dolanor commented 8 months ago

as in

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

?

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

dolmen commented 8 months ago

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)).

dolanor commented 7 months ago

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