Silvan Jegen wrote:
> When scanning the code I saw several cases where you declared and
> initialized variables on the same line like this
> 
>               var void = 0 // target for unused values
>               var dev, rx, tx, rxNow, txNow = "", 0, 0, 0, 0
>               var scanner = bufio.NewScanner(file)
> 
> if you do not want to bother with type declarations I would just eliminate
> 'var' completely by using the ':=' operator.
> 
>               void := 0 // target for unused values
>               dev, rx, tx, rxNow, txNow := "", 0, 0, 0, 0
>               ...

This is also intended. I wanted all variables (apart from the short lived ones
declared in for and if headers) to be easily findable with grep var. Anything
wrong with that?
I struggled a bit between the different kinds of variable declarations and tried
to keep it as consistent as possible with this rule:
In control structure headers, ":=" is allowed, everywhere else use "var".

> In any case, your code looks like idiomatic Go to me. 

Thanks, much appreciated.

Regards,
Markus

Attachment: signature.asc
Description: Digital signature

Reply via email to