On Thu, Mar 13, 2014 at 08:34:04PM +0100, Markus Teich wrote: > Heyho, > > the recent discussion about Go motivated me to finally rewrite my > dwm status shell script. Since this is one of my first programms > written in Go, I would love to get some feedback from you Go gurus out > there. The weird characters in the output are used for coloring and > as icons/separators.
I am not a guru but a few simple things that stood out to me are:
1. The usual way to import several packages is
import (
"fmt"
"whatever"
"etc"
)
2. The same for vars, i. e.:
var (
cores = 1
rxOld = 0
...
)
3. Instead of appending to the same slice several times just use a
slice-literal like this:
http://play.golang.org/p/U8r3Z_crOK
Cheers,
Silvan
pgpL8Qa8TeB3R.pgp
Description: PGP signature
