Recently I started picking up Go again - here’s some of my initial impressions while building a Go version of my picture to ascii site.
Many moons ago
The first time I picked up Go was a while ago, when GOPATH was all the rage. This required you to define one folder on your machine where all Go code would live, so all your projects needed to have the same parent folder. This was also before modules, so dependencies had to be pulled directly from Github repos with implicit versioning (I think: like I said, it was a while ago!). The GOPATH felt really restrictive, and pulling straight from the head of current repos felt really insecure, and I ended up bouncing off Go quite quickly.
Now though, Go modules seem to have solved a lot of the issues that I didn’t like. pkg.go is really nice for finding modules, but while building the ascii converter it turned out that the standard built-in libraries had pretty much everything I needed. This is quite different from Rust or Javascript which have a more minimal approach to built-ins, so gave a nice first impression. When I did play around with adding a dependency I struggled a little at first, which is probably due to familiarity.
Structuring
Structuring the project was quite straightforward too - in Rust for instance, I usually end up creating a libray, a command-line app to test out the library, and a web project which I can host and show off. It was easy enough to have multiple apps in the same structure, although I didn’t come across anything as formal as Rust’s workspaces or something like Turborepo for JS. I did have to do a bit of googling before finding out that there’s a magic internal convention for packages you’re not intending to export.
Testing
Go’s built-in testing setup is really nice, and it’s great to have native options for benchmarking too. Tests had features that I’m used to, for instance grouping tests for related functionality, or providing a table for automated looping through various test options.
Having a setup to create examples, and to test the output from them, is great. It’s very similar to Rust’s doctest and something I really miss in my JS/Node setup; having examples is necessary for others to understand how to use things, and testing them forces you to keep them up to date when refactoring.
Builds
So quick! I’m used to Rust, which is notably slow, and Javascript, which takes time to install dependencies and bundle. Having a large standard library helped for my project since I didn’t need to install any dependencies. Having separate run and build commands is nice too, and allows easy testing.
Overall
I really enjoyed using Go for this small project. Next up is to build something less trivial and to use dependencies more to see how that works.
Some useful sites which helped:

Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.