Go

What I like about Go: It’s quick and easy to create small programs, including support for Docker and everything. For example, today I developed a minimal URL shortener that stores the entries in a SQLite database: https://jlel.se/goshort

Now I have finally found a good use for the domain I recently registered. 😄

I admit it is the first time I am writing code that is almost 100% covered by unit tests. But it’s such a good feeling to have small, concise methods whose functionality you can rely on. Even before I have a running application, I know that what is already written will work. And unit testing with Go is really fun.

Phil Eaton wrote a really cool article. He documented how he used Go to write a rudimentary SQL database including a CLI. It is very interesting to read how commands are parsed and analyzed. The whole thing probably has no practical use (there are already countless mature database systems), but it’s still exciting. I remembered some of the math lectures in the first semester about formal languages.

I wrote about my Indieweb dream this morning. To come closer to this dream and to clean up some code, I started refactoring my hugo backend code. I made use of Go interfaces to later be able to easily add more storage, CDN or social network providers. It also made the code a bit cleaner and a bit more modular, but there’s still a lot of learning and work to do. What I still struggle with though is testing: I don’t have any automatic tests yet. How do I test HTTP calls to external APIs?

Go and Java

While I need to use Java for university projects (currently that are one Spring and one Java EE project) and work, I use Go on some personal projects (Hugo backend and KISSS). While I’m getting more familiar with Go (I do Java for many years), I also experience cases where I actually miss language features from Java. Oh and it’s not generics, I’m currently (still) fine without generics. I miss streams.

Benjaming Congdon shares in an article, why he appreciates Go’s simplicity. To summarize: Its great forward / backward compatibility, dependencies (stable, fewer dependencies needed), included functionality (testing, http, …) and formatting (because Go has an integrated formatter, although every project has its own way to do things, all code follows the same formatting conventions).

This corresponds to my own experiences. When working on my Micropub-endpoint for my Hugo-blog setup, or my website statistics tool, I rarely have any problems with the language itself. Go is simple, so I can think more about the way to solve my problems. The code I write probably isn’t the best, but Go helps getting things done.

My favorite feature: The standard library. For my Micropub project, I currently only need one single dependency, a YAML parser. Everything else I need is already included.

What I wish for: Better error handling.

I develop code in Go for just a few months now, but I learned to like it. It’s fast, simple and can produce static binaries. In contrast to Java (the language I have to use for a lot of university and work stuff) it does many things much simpler. And I think Go is really easy to learn, also thanks to its good documentation.

There are over a million Go developers worldwide, and companies all over the globe are looking to hire more. In fact, people often tell us that learning Go helped them get their first jobs in the tech industry. In the end, what we’re most proud of about Go is not a well-designed feature or a clever bit of code but the positive impact Go has had in so many people’s lives. We aimed to create a language that would help us be better developers, and we are thrilled that Go has helped so many others.

A few months ago, I tried to learn Go. I did it just out of curiosity and because I heard many great things about this programming language. I also use much software, which is written in Go, like the generator for my websites (Hugo), Git server (Gitea), feed reader (Miniflux) or Docker. All are written in Go and have in common, that they have an incredible performance and are really easy to setup, because it’s possible to compile everything to a single statically linked executable.
Jan-Lukas Else
20 years old student who writes about everything he cares about.