Richard Bucker

Things that make me happy in go(lang)

Posted at — Feb 5, 2015

mattbasta pasted that there were some things that he hated about go but that never provided a way to receive comments. Shame. It’s an interesting topic.Project LayoutThis simply means he does not understand the tools and their potential. And when those tools fail there are others to help like: glide, godeps, golo(mine), goli, make.go and a few others.Relative Package ImportsThat’s just a stupid idea and is similar to the first topic. Namespaces are important and until someone finds a way to make global namespaces simple then that’s just the way it’s going to be. It would be interesting to have some sort of local registry but then by the time you do that you end up with a filesystem based on some pattern. and so the argument gets recursively redundant.The Big Community MessI’m not sure how the first two items are the communities problems. Frankly, GOPATH, GOROOT, GOARCH, GOOS are the one-stop shop. As far as NSQ having a gnarly makefile… you’ve never used autotools/automake or you’d have a completely different view, however, if you want to see the right way then look at the gnatsd implementation of it’s docker build. It has to be the sexiest build I’ve ever seen and hits all my touch points.Obvious Missing FeaturesDeleting an item from a slice should require arr = append(arr[:idx], arr[idx+1:]…). How is that friendly?He kinda has a point here, however, the problem is that slices are not really arrays. And for all the gore this is probably the best way to rationalize slicing things. (append slice 1 to slice 2; as simple as that)There is absolutely zero implicit type casting. Comparison operators could benefit from this the most. int64 and int? Can’t compare them.Thank goodness. It’s impossible to reason about implicit casting otherwise everything would be an interface{}. And what fun is that. This simply makes everything explicit so that there are no side effects. And side effects will get you every time. (of course this would make it a dynamic language and that it’s not)Nested function syntax is very awkward. Why can’t nested functions optionally use the same syntax as non-nested functions? We may never know.Sadly, I do not eve know what you’re talking about here. This could be anything. Returning a reference to a function or assigning a reference to a function to a variable are pretty sensible.Integer math. All of the math functions (abs, floor, etc.) operate on float64s. Go needs an imath library to do anything useful with integers at all. Presently, you need to write all of your own commonly used math functions yourself.I hate all math and I especially hate float. If you’ve ever done any real math with floats you’ll quickly come to the understanding that you have to move to bigint or some such. The reality is that floats based on base10 do not work very well on a base2 system.That’s why 2-1=0.999999999 or something like that.There’s a distinct lack of basic data structures. set? Nope. Sugary queues or stacks? Nope. Ordered maps? Nope. Heaps? Nah. While of course it’s possible to build all of these ourselves, it’s not ideal. And frankly, the ones that are available as libraries in the community are mediocre at best.It seems clear to me that you do not really understand what you have in front of you. What you seem to be lacking without actually saying it is generics¬†and for that you can fuck off. (sorry). I’m sick to death of all those java programmers that think generics are the only language feature that separates any modern language from the stone-age.Any thanks for reading. Let me know what you think.UPDATE: there was another article that went down the same rabbit hole.UPDATE 2: And then there was a positive article in my reading list. The few weaknesses he mentions are reasonable.