Re: [dev] golang dwm status

From: Silvan Jegen <s.jegen_AT_gmail.com>
Date: Thu, 13 Mar 2014 21:00:58 +0100

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


Received on Thu Mar 13 2014 - 21:00:58 CET

This archive was generated by hypermail 2.3.0 : Thu Mar 13 2014 - 21:12:06 CET