filmov
tv
How to force package users to use struct composite literals with field names ? #golang #tips #shorts

Показать описание
How to force package users to use struct composite literals with field names?
Package developers can put a non-exported zero-size field in a struct type definition, so that compilers will forbid package users using composite literals with some field items but without field names to create values of the struct type.
#golang #golanguage #tips #tipsandtricks #programming #backend #backenddeveloper #backenddevelopment
Package developers can put a non-exported zero-size field in a struct type definition, so that compilers will forbid package users using composite literals with some field items but without field names to create values of the struct type.
#golang #golanguage #tips #tipsandtricks #programming #backend #backenddeveloper #backenddevelopment