Over the last few weeks I have been looking into Go a.k.a. Golang. First off, it was a great experience to start coding in the language.
I had previously looked into Rust. I learned a lot about the underlying concepts when I eventually decided to let it rest, and it was obvious to me that if one gets a program written in Rust to work, it will likely run extremely well and safe. But getting it to run was just too much of a frustration. Where it'd have me an hour to get some trivial task done in PHP, it'd have taken me days to do the same in Rust. No matter the differrence in experience I had in the two languages, the difference was just too much and the process too tedious.
Go was thus my second attempt at really learning a modern compiled language with the aim of getting comfortable in it. Following its reputation, it's indeed a compiled language that feels like a scripting language. It's fast enough to learn the basics to not be frustrating at all and one soon has learned enough to implement meaningful tasks.
As my favorite way for getting comfortable in a programming language is implementing things that are actually useful at least to me, I went on to do so quite soon.
My first larger project in Go was reimplementating pyclitr, a little command line tool modelled after taskwarrior, which notes down the user who is currently adding or modifying a task and works on a per-directory basis (I have since put up pyclitr on GitHub, mainly for documentation purposes). I wrote pyclitr over a sleepless night some time last year in Python and was rather unhappy with the implementation, although I never got around to improving it after. On the other hand, having a tool for to-do lists on a per-directory basis comes in handy often, especially if one is working with git.
Reimplementing pyclitr in Go offered a nice opportunity to write the a prettier version, remove unnecessary parts and add functionalities that had turned out to be needed. The two main changes and additions are
- To modify a task, one no longer needs to enter a uuid, but just enters its current ID
- On the first run of the program, a folder is created at
~/.config/goclitrcontaining a list of all directories in which the user has created or modified tasks.
Goclitr (now renamed also, as the py in pyclitr stands for Python) can be found at GitHub.
eAureumFV (on GitHub) is my second project and was my first attempt at writing web applications (mainly) in Go. At home, I have a Raspberry Pi connected to my loudspeakers that I mostly use for playing music with remote control. After connecting a screen to it, I wanted to access other files from it, too. As my hard drives are connected to another maschine, I needed a way to stream them. The easiest way to implement that seemed to watch them in a browser, streamed via HTTP. Of course, the same would have been possible with simple ssh, but this offered a nice login-free solution.
eAureumFV offers an HTML interface to the contents of a given set of folders, with in-browser previews where HTML5 supports the given file format. A special type of preview are previews of CBZ files, which are unpacked into memory and served from there. Each file page comes with two modes: the default one showing the file name, preview, and very basic information on the file, and a window-filling preview.
Maybe another special feature for a web-application is the keyboard-driven workflow: I barely use the mouse when not using a browser and did not want to have to reach to it when using a navigation-intensive application like this. Hence, all contents can be navigated to using keyboard shortcuts.