Jumping into Go

I finally did it. I jumped into Go and I like it. Many years ago (7 or so?) a dear friend of mine told me about Go and that I should give it a try. He did warn me that the language felt like Java of the olden days, back when Java was 1.0, but despite this Go was a pretty good language. I did give Go a try a few times in the past, even presented a couple of times (at work and abroad) about the similarities and differences between Java and Go from a Java developer’s POV, yet I didn’t find a true reason to get going with the language, I was quite comfy with Java and Groovy. And it’s the latter the one that convinced me to give Go another try.

Back in July 2006 I went to a NFJS Symposium in Austin because I wanted to know more about testing and TDD with Java. Little did I know that I’d be bombarded with Ruby content for 2 days so much that I thought Ruby would be my next language. It totally convinced me. I was ready to give it a try but being cautious I didn’t want to let go of Java just yet as back home in Mexico hardly anyone was using Ruby for professional work. Thus I looked for an option to combine both, luckily for me there was JRuby, awesome! But it didn’t work very well with Maven at the time. Bummer. Just before the end of the last day, I made it to 2 sessions that completely changed my life: Venkat Subramanian and Scott Davis showcased the testing possibilities provided by Groovy and Java combined. And there it was. A language that looked like Ruby if you squinted your eyes, even sounded like it, yet it was closer to Java. I got hooked immediately.

So what does that story has to do with Go now? Groovy 1.0 came out in the late December 2006. There was little information out there to get going. The language even had syntax changes in the last stretch before going 1.0 (those that remember the old days know that Groovy used a different syntax, closer to Ruby, for defining closure/lambda parameters for example) making half of the examples out there no longer compatible. The tooling ecosystem was simply non-existent. I was lucky to get a copy of Groovy in Action 1st edition mailed to me a few weeks after publication, eventually mustered the courage to ask Guillaume, Dierk, and Paul sign it for me when I met them at JavaOne a year later. The point is, there wasn’t much to get quickly started with Groovy, the path was littered with obstacles, sweat, and pain. Yet I walked it. Despite some setbacks, I enjoyed the journey, and I still do.

Jumping into Go today is supposed to be a different story. The ecosystem is thriving. There are docs, books, and examples galore. I highly recommend https://gobyexample.com/ to get started. Tool support is ready. So many things that Groovy didn’t have back in the day. Yet, despite all this, getting into Go felt for me just the same when I started with Groovy. Some things would not simply work and I couldn’t figure out why. Was it the IDE? Was it a missing tool or package? Did I understand the feature differently and am I using it wrong? But I persisted and continued on. This time my excuse was to create a tool that would allow me to invoke either Gradle or Maven on a project, using the same command but also taking into account if their respective wrapper is in place. This tool is called Gum and you can find it here. Granted, there is previous art but it only works for Gradle and I wanted to support the upcoming Maven wrapper that has just been added to Maven 3.7.

From conception to first release it took me what, 14 hours? A third on actually writing the tool itself, another third battling with my misconceptions on how Go works and the IDE (waves at VS.Code), the final third figuring out how to automate releases using GitHub actions. Once the release was published I made a pause to realize what just happened. The whole experience was painful at times but it was fun as well. Finding out new tricks, and the proverbial eureka moment that lets you sort out the obstacle in front of you. That was encouraging. Exhilarating as well. Yes, the code still looks like it was written by a Java developer (I’m still are!) but the tooling helps you get acquainted with the syntax (gofmt & gotlint, annoyed by them at first you quickly learn the ways of Go). I’m pretty sure my Go code will look more idiomatic as I continue down this path.

Does this mean I’m jumping ship abandoning the Java realm following Go’s siren call? Nope. I’m still quite happy with Java and Groovy. Excited by 25 years of Java and quite hopeful for the next 25 years, can’t wait to see how both languages evolve together. But if I see an opportunity to use Go I’ll take it, my friend was right after all. Speaking of which, he has also tried multiple times to get me into Swift … I wonder …

Keep on coding!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

ˆ Back To Top