Re: [go-nuts] Re: Opening brace can't be placed on a separate line killing the language for me
odsh97, More than a million Go programmers agree with you that format and readability is everything. We have a standard tool, go fmt, to ensure it. All Go code conforms. You'll like the uniformity. Michael On Sat, Sep 8, 2018 at 7:50 AM alanfo wrote: > I've never been able to understand why 'go fmt' allows you to add the > function body (apparently of any length) on the same line as its > declaration but doesn't allow a one line 'if' or 'for' statement even if > the body consists of a single short statement. > > So, if you write this: > > if someCondition { break } > > it always rewrites it as: > > if someCondition { > break > } > > This means that you tend to need more lines to write your code in Go than > you would in other C-family languages. > > However, it's only a minor irritation and, as Dave said, a price worth > paying for having a consistent coding style. > > Don't get me started though on 8 space tabs :( > > Alan > > -- > 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. > -- *Michael T. jonesmichael.jo...@gmail.com * -- 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.
Re: [go-nuts] Re: Opening brace can't be placed on a separate line killing the language for me
I've never been able to understand why 'go fmt' allows you to add the function body (apparently of any length) on the same line as its declaration but doesn't allow a one line 'if' or 'for' statement even if the body consists of a single short statement. So, if you write this: if someCondition { break } it always rewrites it as: if someCondition { break } This means that you tend to need more lines to write your code in Go than you would in other C-family languages. However, it's only a minor irritation and, as Dave said, a price worth paying for having a consistent coding style. Don't get me started though on 8 space tabs :( Alan -- 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.
Re: [go-nuts] Re: Opening brace can't be placed on a separate line killing the language for me
On Sat, Sep 8, 2018 at 12:01 PM Mark Volkmann wrote: > How did you do that? I don’t see any formatting configuration. Correct, there's none. -- -j -- 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.
Re: [go-nuts] Re: Opening brace can't be placed on a separate line killing the language for me
How did you do that? I don’t see any formatting configuration. --- R. Mark Volkmann Object Computing, Inc. > On Sep 8, 2018, at 3:48 AM, Jan Mercl <0xj...@gmail.com> wrote: > > On Sat, Sep 8, 2018 at 10:14 AM Dave Cheney wrote: > > > I personally don't like that I cannot write one liner functions on one line > > because of gofmt's preference for reformatting the same function over three > > lines ... > > Please navigate to https://play.golang.org/p/VPfFLIyhUqp and click format. > > -- > -j > > -- > 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. -- 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.
Re: [go-nuts] Re: Opening brace can't be placed on a separate line killing the language for me
On Sat, Sep 8, 2018 at 10:14 AM Dave Cheney wrote: > I personally don't like that I cannot write one liner functions on one line because of gofmt's preference for reformatting the same function over three lines ... Please navigate to https://play.golang.org/p/VPfFLIyhUqp and click format. -- -j -- 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.