Posts

Showing posts from September, 2018

Frustrations with Go

After a couple of years programming in Go the honeymoon is definitely over.  I have thousands of lines of Go code sitting on Github now and I don't think I will be abandoning it, but it's time for a little rant. There is a lot to like about Go - above all its simplicity.  But this simplicity comes at a cost; some apparently uncomplicated things have been omitted from the language and these tend to increase significantly the SLOC of Go programs and packages. Missing Features Enumerations Although these can superficially be simulated with constants, doing so does not give you the safety of having the compiler warn you when you omit a case in a switch statement.  It seems to me that this is precisely the kind of programming error that the Go authors claimed to want to eliminate with the language. Consts in Structs Time and again I have found myself wanting to write something like type someT struct {   const maxThings = 20   ... } ...more lines of code required.