On Thu, Sep 5, 2019 at 10:59 AM Sotirios Mantziaris
<smantzia...@gmail.com> wrote:
>
> I would liked that gofmt would handle this one also in order to avoid battles 
> about what is the correct line wrapping in go.
>
> In Effective Go there is a section, with smaller fonts than the usual 
> document that states:
>
> Line lengthGo has no line length limit. Don't worry about overflowing a 
> punched card. If a line feels too long, wrap it and indent with an extra tab.
>
> The above line leaves a lot of room for interpretation:
>
> Assume you have something lengthy, which is also left for interpretation, you 
> should wrap and ident with an extra tab:
>
> Now I have the following outcomes:
>
> shinyThing := New(argument1 string, argument2 string, argument3 string,
>   argument4 string, argument5 string)
>
>
> you have
>
> shinyThing  := New(
>   argument1 string,
>   argument2 string,
>   argument3 string,
>   argument4 string,
>   argument5 string
> )
>
> and there are possibly 100 more variations out there.
>
> I personally prefer the first one because I use as much horizontal space as I 
> can (i have a limit for 120 chars per line) and I use as little as possible 
> vertical space in order to not need to scroll. I optimize for having as much 
> as possible in one screen.
>
> Does anybody have a convention that is generally accepted for this?

There is some discussion at
https://golang.org/wiki/CodeReviewComments#line-length .

> Would this make sense to be part of gofmt?

I don't think so, because good line breaks require semantic knowledge
that gofmt doesn't have.

Ian

-- 
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/CAOyqgcWg-B79pLpmc-AjVh6z98fFNiFZv%2B8UwpKQNiCrH4Bi4Q%40mail.gmail.com.

Reply via email to