Does this issue reproduce with the latest release?
In the playground, yes.
What did you do?
https://play.golang.org/p/uQjX9qTwBz1
package main
type S struct {
Name T
}
type T struct {
First string
}
func main() {
_ = &S{
Name: &T{First: "Rob"},
}
}
What did you expect to see?
An error message pointing out the T vs. *T type problem.
What did you see instead?
prog.go:13:7: cannot use T literal (type *T) as type T in field value
The error message is there, but it is phrased oddly. cannot use T literal is confusing. I'm using a &T literal. If you put aside the parenthetical for a moment, the oddness is apparent: cannot use T literal as type T in field value. I think this error message could be improved.
Does this issue reproduce with the latest release?
In the playground, yes.
What did you do?
https://play.golang.org/p/uQjX9qTwBz1
What did you expect to see?
An error message pointing out the
Tvs.*Ttype problem.What did you see instead?
The error message is there, but it is phrased oddly.
cannot use T literalis confusing. I'm using a&T literal. If you put aside the parenthetical for a moment, the oddness is apparent:cannot use T literal as type T in field value. I think this error message could be improved.