Nick, thank you for releasing this useful tool as open source. I'll
give it a try later on my raspberryPi.
I have a few style suggestions, but this is not a complete review yet.
Only after writing this email I realized it would have been easier to
add the comments to github directly. I'll do that in the next round of
reviews.
constants like SIZE are better named as Size. This style wasn't
followed in early Go programs, but it's now more common (see the time
package for example)
functions like read_file() should be named as readFile().
variables like read_speed should be named readSpeed.
The "const MB" declaration should be at the package level.
Don't call panic in outputDiff(). Use errors instead.
Calling os.Exit(0) in initialiseStats() is a bit weird. Can't you use
the 'finished' channel instead?
Your doc comments don't follow the usual style. See
http://golang.org/doc/effective_go.html#commentary. Specifically "Doc
comments work best as complete sentences, which allow a wide variety
of automated presentations. The first sentence should be a
one-sentence summary that starts with the name being declared."
Your single-letter flags (w, r, R) are, in my opinion, abusing the
flags system. They are command names, not flags, so they should be
positional arguments. Use flags.Args() to look at positional
arguments. The "go" program command line interface is an excellent
example. A user runs:
go fmt -x <package>
Instead of:
go -fmt -x <package>
Underneath, the go tool commands are pluggable structs with attached
functions, which looks quite nice in code. See:
http://golang.org/src/cmd/go/main.goThis package should help writing command line tools using the go tool
style:
http://code.google.com/p/go-commander/. It needs better
documentation, but could be useful already.
On Sat, Sep 22, 2012 at 10:10 AM, Nick Craig-Wood wrote:This is my first released bit of Go code
https://github.com/ncw/stressdiskit is a utility for stressing disk drives to check them out before you
trust your data to them.
The original was a C program with a Perl driving script - I re-wrote it
in Go so I could have fast and easy in the same language! Sticking some
goroutines in made it faster too.
If anyone would like to comment on the code I would be grateful
Thanks
Nick
--
Nick Craig-Wood <
[email protected]> --
http://www.craig-wood.com/nick--
--
Yves Junqueira <
http://cetico.org/about>
--