3 ms·
> Second, a key in a struct literal may now be any valid field selector for the struct type, allowing fields in nested or embedded structs to be initialized dir
by olingern 2mo ago
> Second, a key in a struct literal may now be any valid field selector for the struct type, allowing fields in nested or embedded structs to be initialized directly
It's been a while since I've written more than anything trivial in golang, but this seems like a big deal to me. As in, I can define a struct that is consistent and reusable in other structs
- konart 2mo agoThis is quite a QoL issue, but is it big? Nothing changes from functional point of view.
- onionisafruit 2mo agoIt will be very nice working with code generators like oapi-codegen that can generate either nested structs or very unwieldy struct names. So big in that context, but like you said just a nice qol improvement most of the time.
- andreimackenzie 2mo agoThis will shorten many test files!
- qwm 2mo agoIf I'm being honest, I actually hate this feature. I like things being obvious, and structs were always something I could rely on being very explicit.