about
projects
blog

Learning Go

I started learning Go a few months ago now. I decided to start exploring the language because I was interested in learning a compiled language that was basically faster than JavaScript. I've also been looking for a developer role for over a year now, and I am always looking for things that can make me stand out from others that are around my experience level.


I started with a course on Front End Masters, that was a nice introduction to Go and some of its core features and syntax. After walking through the basics, we built a few small programs, including a CLI application and a web service. After the course, I started exploring a few of the web frameworks that seemed to be popular with the Gophers, including Echo and Gin. I built out two updated portfolios using HTMX, and Gin, with sqlite, and this site is the result of the second version.


Building out the backend was very similar to using Node, but Go has its own way of dealing with data, json, and database connections that took a little getting used to. I used the built-in templating system for server side rendering the html. The syntax is very similar to Jinja, Handlebars, EJS, or probably any other templating system, so that was pretty straightforward. Another feature that I am a fan of is the constants for status codes that are available through the http package. This makes it a lot more developer friendly when building out the api, and when I am in need of particular status code, I can quickly browse the available constants, rather than going on a GPT or Google journey, trying to figure out which status code I need.


Other than that, I've also been working on Leetcode problems using Go, which is probably not the best to use on a timed test, but it does help to get familiar with the language. I think that Go shines when it comes to writing readable, and performant code. However, it can also be a little verbose, and seems to lack a lot of the convenient, built-in functions, that are available in other languages. For example, there is a built-in math.Max() function, but I've found it much easier just to quickly write my own max function, since the one from the math package will only take float64 for arguments, which is annoying when you are working with int for example.

Some ideas that I am thinking about include, doing some Advent of Code problems. I completed about 12 from the 2024 challenge in Typescript as of this writing, and I'm sure I would learn a lot more about the language if I start working through some of those problems. I am also working through a book called Get Programming with Go, by Roger Peppe, and Nathan Youngman. I am enjoying the book so far, although the Caesar Cipher with keyword, gave me quite the headache earlier today! Maybe I will dive into some of the details on one of these topics for my next post...