“Go”ing from Python

One thing I’ve loved about technology (particularly the web) is how ideas and work can be shared with everyone who has access to the internet. My dad and I used to get in fun debates about the value of certain professions for a society and while we always agreed in the end that every vocation was equally valuable, there’s something special about developing a medicine that the average person can benefit from without knowing a single thing about biology or chemistry.

Since I don’t have access to labs any more my next best thing is putting little web apps together for my groups of friends to do silly things like keep track of shows or run analysis on fantasy football. Like most retired hard science folks, my journey started with Python as a “better” MATLAB or VBA. There was always R, but no one likes R (just kidding).

Python allows anyone to throw together an application and get it in front of people quickly, making it an excellent choice for just about anything. In fact, I still use Python for just about everything of real value. There’s nothing like writing a function to do something, slapping it into a Flask app with like 5 lines of code, and boom, instantly accessible with a browser from anywhere.

Recently I’ve become a bit lazy when it comes to managing servers which hasn’t played well with the removal of the free tier on Heroku. I used to like figuring out how to run servers to drop my monthly costs from Heroku to the most minimal AWS instance (forever a manufacturing engineer…). Deploying Python apps can be made easier with things like Docker but the fun quickly evaporates when you spend more time trying to share the thing than actually building the thing.

Enter Go (or golang). I’ve tried compiled languages in the past and always liked the ability to end up with an actual executable binary but always went back to Python after getting into the “deep end” when it came to things like memory allocation and pointers. My forays into security CTFs have also highlighted that I don’t have the skills to safely build with these languages. Go seemed deceptively simple, basically compile checking the type hints I was already using in Python and giving “credit” for the rigor by producing tiny files to run on any hardware.

The biggest change however, is how fun it is to put Go apps together. The community mindset of “stick with the standard library” and “avoid magic” is so refreshing – so many tools are built to reduce boilerplate or be more “declarative” and can end up abstracting away all the logic that makes things work. It can be soothing to write actual SQL and handle errors in the way you want. I find myself getting held up on parsing JSON into structs and getting a bit frustrated, which really just points out how lazy I’ve been throwing dicts around in Python.

I’ll probably spend the next few months rebuilding all my tools and apps in Go as an exercise to learn the language, but also to just enjoy coding again. Maybe it’s because it’s stuff that I’m doing for fun and not for money, but dang, it’s a blast.

Leave a comment