Just declare the parameter as type Type and then in the method check if it is 
an interface. 

The caller uses the interface type. 

> On Dec 9, 2018, at 2:43 PM, Jan Mercl <0xj...@gmail.com> wrote:
> 
> On Sun, Dec 9, 2018 at 9:23 PM Mark Volkmann <r.mark.volkm...@gmail.com> 
> wrote:
> 
> > Is it possible to pass an interface to a function in Go? I don’t want to 
> > pass a value whose type implements the interface, I want to pass the 
> > interface.
> 
> I think the question is not clear enough. Could you please provide an example 
> of what you would like to write, what you tried and where the compiler error 
> occurs, if any?
> 
> -- 
> -j
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to