Book Review: Go in Action, by William Kennedy
At work, we are increasingly using
Go(lang) as a leaner and faster alternative to Java for our microservices and I felt it would be worthwhile reading up on the subject. Gone are the days of enormous tomes, though this was still a paper book.
My thoughts are a mix of good and bad, and it's not always obvious whether they relate to the book or to Go itself. Go is not a replacement for Java; rather, in many ways, it is a successor to C (not C++). There are some features I definitely like, such as functions with multiple return values, reflection-based interfaces, and built-in concurrency; some things, such as object composition, on which I'm undecided but curious about; and some things - mostly absences - that I'm not very keen on, such as the lack of structured error handling and the significance of whitespace. I'm using the
Goclipse plug-in for Eclipse, which seems to catch only some errors, leaving apparently good code to fail at the compiler stage.
The book is intended for "intermediate-level programmers from other languages such as C or Java". Frankly, as someone who has never successfully programmed in C, I found this a bit of a dubious claim. I know what pointers are, but I do get confused by them, and the minimal explanation of Go's pass-by-value semantics didn't feel very clear. I have to think too hard about things like that. Also, explanation about zero-values should have been earlier in the text: to a Java programmer reading early sections it looked like null pointer exceptions should have been thrown. One of the examples, on resource pools, looks to me as though it will grow without limit. With gripes such as these aside, though, I do feel as though I've had a reasonable introduction to the language and its idioms. To my sceptical eye it looks like there's a lot of boilerplate code, but there's no denying that Java can easily become bloatware. There's an in-built testing framework but it's extremely basic compared to Java frameworks such as
JUnit and
Mockito. Nonetheless the book must be counted a success in so far as getting me to the point of writing some simple but useful code within a week.