Groups
Groups
Sign in
Groups
Groups
golang-nuts
Conversations
About
Send feedback
Help
How to cast type alias and interface to int
974 views
Skip to first unread message
so.q...@gmail.com
unread,
Dec 20, 2016, 3:45:33 AM
12/20/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts
How would I cast type alias MyInt and interface Foo, to an int?
https://play.golang.org/p/Sb80WoKh4Y
Volker Dobler
unread,
Dec 20, 2016, 4:13:35 AM
12/20/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts
Like
bar = int(foo.(MyInt))
that's: type-assert that foo is a MyInt and convert the MyInt to int.
V.
so.q...@gmail.com
unread,
Dec 20, 2016, 4:24:25 AM
12/20/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts
Thanks!
Christian von Kietzell
unread,
Dec 20, 2016, 12:02:19 PM
12/20/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to so.q...@gmail.com, golang-nuts
On Tue, Dec 20, 2016 at 12:45:33AM -0800,
so.q...@gmail.com
wrote:
> How would I cast type alias MyInt and interface Foo, to an int?
>
>
https://play.golang.org/p/Sb80WoKh4Y
bar = int(foo.(MyInt))
Chris
--
Nothing to see here. Move along.
Reply all
Reply to author
Forward
0 new messages