Re: [dev] golang dwm status

From: Charlie Andrews <charlieandrews.cwa_AT_gmail.com>
Date: Thu, 13 Mar 2014 16:11:27 -0400

On Thu, Mar 13, 2014 at 09:00:58PM +0100, Silvan Jegen wrote:
> 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:
>

I write go for a living, and these 3 comments were the only ones off the
top of my head as well.

> 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

this also decreases the amount of allocations the runtime does.

>
>
> Cheers,
>
> Silvan
>

Other than that, looks great!

-Charlie
Received on Thu Mar 13 2014 - 21:11:27 CET

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