In general, is it advisable to return pointers to newly constructed instances when using constructors?
Would it matter more for types that don't have members of composite types slice and maps? So in the following example, https://play.golang.org/p/sWTWkHfZfB Bar is made up of mostly strings, so should return a pointer as those strings could be long. While Foo is constructed of a slice and map, which are just references. So the constructor can return Foo as a value with little overhead. And Qux has both a string and slice, but should return a pointer since the string can be large. For interface Baz, returning a value is acceptable as its just a reference to Foo, Bar and Qux. Is that all correct? Or should I just always return a pointer? Any other advise? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.