I feel there is a significant difference between the two: func-literals are
expressions, while if-statements areā€¦ statements :) i.e. I'd rather be in
favor of reformatting func-literals, but I believe the fact that they are
expressions makes that not a great idea, as they are often used in
arguments to function calls and the like and you probably don't want to
forcibly split those.

On Sat, Jan 6, 2018 at 5:09 PM, Tong Sun <suntong...@gmail.com> wrote:

> Hi,
>
> *[This is just a thought, no flaming please if you don't agree]*
>
> Since `gofmt` supports one line func() definition, how about maintaining
> one line if statement as well if the user did so?
>
> This way, many of the simple three line code can be simplified to one:
>
> I.e., from
>
>  if !condition {
>    return
>  }
>
>
> to just
>
>  if !condition { return }
>
>
> *provided* that the user uses the one line if format in the first place.
>
> Thus, a *typical sample* code can be dramatically simplified, because so
> many three-line error checkings can now be,
>
> if err != nil { panic("something wrong") }
>
> Thoughts?
>
>
> --
> 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.

Reply via email to