On Thu, Mar 13, 2014 at 09:21:09PM +0100, Markus Teich wrote:
> 
> If you like, please explain the benefits of the first 2 points a bit more
> detailed (see my other mail for my reasoning)

In both cases, I believe it's much more readable and maintainable to
have a section for imports and a section for vars (global-ish variabls).
Readability is subjective I guess, but maintainability is not, and it is
much easier this way to add imports and vars with fewer key strokes
later. If I wanted to log a random part all I would have to do is pop in
"log" into the list and go on my merry way. This is a very small
workflow optimization, but who knows what a few seconds saved here could
do.

> Ok, I will try to find a readable way for the slice-literal then. Thanks.

I find this very readable:

newSlice := []string{
        "string1",
        "string2",
        "string3", // yes you need the comma here
} 

but again, readability is subjective, so it's up to you.

-Charlie

Reply via email to