I wish there were more cases where the types could be elided. Always
leaving it off would be a bad idea but how much to put in should be at
the author's discretion. There are times when it clarifies but more
times when it just adds extra steps. I know that the current rules
have justifications but
On Fri, Aug 4, 2023 at 8:08 AM Nate Finch wrote:
>
> If I have a struct
>
> type User struct {
> Name string
> ID int
> }
>
> type Group struct {
> Leader User
> }
>
> Why is it that the go tool can't infer what type I'm constructing for the
> Leader field here?
>
> g := Group{
>
If I have a struct
type User struct {
Name string
ID int
}
type Group struct {
Leader User
}
Why is it that the go tool can't infer what type I'm constructing for the
Leader field here?
g := Group{
Leader: {
Name: "Jamie",
ID: 5,
},
}
Cleary, the