Use Field Names to initialize Structs

You should almost always specify field names when initializing structs. This isnow enforced by go vet.

BadGood
  1. k := User{"John", "Doe", true}
  1. k := User{
  2. FirstName: "John",
  3. LastName: "Doe",
  4. Admin: true,
  5. }

Exception: Field names may be omitted in test tables when there are 3 orfewer fields.

  1. tests := []struct{
  2. op Operation
  3. want string
  4. }{
  5. {Add, "add"},
  6. {Subtract, "subtract"},
  7. }