Silvan Jegen wrote:
> 1. The usual way to import several packages is
>
> import (
> "fmt"
> "whatever"
> "etc"
> )
I know that it is possible, but what benefits do I get? I decided against it,
because on small laptop screens I get 2 loc more on the screen and the few bytes
necessary for the multiple „import“ statements should not be an issue with
todays hard disks.
> 2. The same for vars, i. e.:
>
> var (
> cores = 1
> rxOld = 0
> ...
> )
Same argument applies here. This could be used to visually group a subset of
variables which belong together in some way, but I did not find such a case in
my code.
> 3. Instead of appending to the same slice several times just use a
> slice-literal like this:
>
> http://play.golang.org/p/U8r3Z_crOK
I actually had it this way before, but changed it, because I found it very
confusing and unclear to read. Also I don't think it has a performance impact
since the slice-literal gets filled with dynamic-length return values each time.
Nevertheless, thanks for the feedback, Silvan.
Regards,
Markus
Received on Thu Mar 13 2014 - 21:18:27 CET