2 ms·
func NewBaz() Baz { in a package called baz is already unidiomatic, in cases like that, the function should just be called `New`, leading to usage like: thi
by Vendan 9y ago
func NewBaz() Baz {
in a package called baz is already unidiomatic, in cases like that, the function should just be called `New`, leading to usage like:
thing := baz.New()
which, to my eyes, is perfectly fine.
- dullgiulio 9y agoAnd the returned Baz should be a pointer.
- Vendan 9y ago.... Only if it's meant to be a pointer. Don't just make everything a pointer.