Charlie Andrews wrote:
> 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.
In this small programm it probably will not matter, but I fixed it to get used
to it for bigger projects. ;)
> I find this very readable:
>
> newSlice := []string{
> "string1",
> "string2",
> "string3", // yes you need the comma here
> }
This is also way better than the solution[0] I came up with. Thanks!
--Markus
[0]
https://github.com/schachmat/gods/blob/b48e7442315156209edfee3b77d3f5e9dfe06fe3/gods.go#L145
Received on Thu Mar 13 2014 - 21:53:00 CET