Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inconvenient Constructor type alias #20

Open
arussellsaw opened this issue Jan 26, 2016 · 2 comments
Open

inconvenient Constructor type alias #20

arussellsaw opened this issue Jan 26, 2016 · 2 comments

Comments

@arussellsaw
Copy link

type Constructor func(http.Handler) http.Handler is used for defining middleware functions, and is used as part of New(constructors ...Constructor) { this has caused some problems for me due to the lack of implicit type aliasing on sliced variadic parameters. example here: https://play.golang.org/p/5arBiRLckG
the issue i'm facing is that i'm writing a package where i'd like to users to be able to define a slice of func(http.Handler) http.Handler and not have to import alice in order to provide them. i know i can iterate and manually do the type conversion, and i'm doing that for now, but i figured i'd make this issue anyway just as something for you to consider.

Thanks

@Thomasdezeeuw
Copy link

Maybe add a little wrapper function like so: https://play.golang.org/p/OTP4olTA6T?

@dolmen
Copy link
Contributor

dolmen commented Feb 18, 2024

The life of users of this package would be easier by just defining Constructor as a type alias instead of a "hard" type:

type Constructor = func(http.Handler) http.Handler

That would solve @arussellsaw's problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants