Go type syntax

115 views
Skip to first unread message

Lucio

unread,
May 23, 2018, 6:15:24 AM5/23/18
to golang-nuts
I can't believe I've overlooked this "feature" in the documentation. I came across this by accident, no doubt I changed my mind without completing the operation and forgot the equals sign.

package main

import (
"fmt"
)

type label = struct{ i int }

func main() {
v := label{i: 10}
fmt.Println(v.i)
}

Jan Mercl

unread,
May 23, 2018, 6:20:34 AM5/23/18
to Lucio, golang-nuts



On Wed, May 23, 2018 at 12:15 PM Lucio <lucio...@gmail.com> wrote:

> I can't believe I've overlooked this "feature" in the documentation.

--

-j

Lucio

unread,
May 23, 2018, 6:52:39 AM5/23/18
to golang-nuts
I'm slow... I should have picked it up, I did vaguely follow the discussion over type aliases.

Oh, well, just shows.

Lucio.
Reply all
Reply to author
Forward
0 new messages