IMO opinion the answer is nicely demonstrated in the alignment of sone of the closing braces you've chosen in the func bar example.
On Tue, Oct 6, 2020, 19:28 tapi...@gmail.com <tapir....@gmail.com> wrote: > IMO, the bar function is cleaner and more readable than the foo function. > How do you think? > > func foo() { > if vs := f(); len(vs) == 0 { > } else { > for _, v := range vs { > } > } > > if vs := f(); len(vs) == 0 { > } else { > switch { > case len(bs) == 0: > case len(bs) == 1: > default: > } > } > } > > // vs. > > func bar() { > if vs := f(); len(vs) == 0 { > } else for _, v := range vs { > } > > if vs := f(); len(vs) == 0 { > } else switch { > case len(vs) == 0: > case len(vs) == 1: > default: > } > } > > -- > 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. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/6b6d44d7-2ce5-4cd0-9347-88b350715088n%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/6b6d44d7-2ce5-4cd0-9347-88b350715088n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAA40n-UJfboUG7P52vgwSsMy6-cndSTP%3DHMc5L%3D0pd2eS-5GOw%40mail.gmail.com.