What is empty or nil interface (e.g. interface{})

79 views
Skip to first unread message

netconn...@gmail.com

unread,
Jun 23, 2020, 12:34:02 PM6/23/20
to golang-nuts
I see this occasionally used as an argument? What's the benefit?

Thanks

Sam Whited

unread,
Jun 23, 2020, 12:37:09 PM6/23/20
to golan...@googlegroups.com
The Go tour has a section on this that might be helpful:
https://tour.golang.org/methods/14

It matches any type, and should be avoided at all costs unless you
really know what you're doing. It sounds great, but it will probably
hurt you unless you have a deeper understanding of writing good Go code.

—Sam
Reply all
Reply to author
Forward
0 new messages