Hi gophers

I've a litte question about best practice for struct initialisation.  For 
example one can initialise structs like:
type A struct {
   name      string
   firstName string
}

a1 := A{"Mueller", "Max"}
a2 := A{name: "Mueller", firstName: "Max"}

The first one is concise and intuitive, but the second is more robust in 
case of refactoring.
If anyone adds a string field at the beginning of the struct, it compiles 
fine but changes the meaning of all initialised structs in the project, if 
nobody 
pays attention to that.

Is there any best practice or advises how structs should be initialised 
and/or refactored?

Cheers

-- 
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.

Reply via email to