Mastodon

Write Freely Python Client

After some debate and testing this morning, I think I’ve decided that I’ll most likely use Python for my proposed Write Freely CLI/TUI client. I created a repo for it, though I don’t have anything committed yet. I was initially debating between Python—a language with which I’m moderately familiar and trying to work with as much as I can since most of the things I do for work leverage it—and Go—a language which interests me but which I don’t know very well at all.

I have to admit that I was initially leaning toward Go for a few reason. First is that, in a perfect world, I eventually work on this project for a long time and it becomes something that other people may want to use. In that case, packaging things up for other people to use outside of something like a Docker container is a bit of a pain with Python. You can’t really expect most people to leverage a Python virtual environment to run your code. I also don’t particularly like making virtual environments all the time since my VPS doesn’t exactly have a ton of storage space. I figured Go would solve both of these problems since I wouldn’t need a virtual environment, and I could easily bundle my finished code up as a single executable, one which I could cross-compile for every platform if I so desired.

In practice, however, the space efficiency wasn’t great. Part of the problem is that I wanted to use the vim-go plugin, which requires a fairly hefty download of extras, accomplished via running :GoInstallBinaries from within Vim; if you don’t do this, you’ll see errors whenever you open or attempt to save a new .go file.

My bigger issue, though, is that it was pretty confusing to me off the bat just how to organize a Go application. I’ve written several very small Go applications before, and all of them were contained to a single file. Doing this is a nightmare as far as keeping things organized goes, and it very quickly becomes difficult to remember what is where as I scroll endlessly back and forth in a single file. I did some research on how projects should be organized, but despite having a page documenting exactly that, I honestly found the documentation very difficult. It doesn’t give concrete examples showing the file structure and seems to make a lot of assumptions about what people already know. It’s entirely possible there’s other documentation I should be reading prior to reading the link I just shared, but if that’s the case then I wish it was linked to from within that page.

Ultimately, I decided that trying to figure out things like this with Go seemed like a bit too much of a hurdle on top of also just learning how to do pretty much everything I need with the language. I do have some Udemy courses on Go that cover more in-depth topics than the books I’ve previously read (e.g. creating a full stack web application), so I may try to watch some of those in order to figure out if they help me any from an organization standpoint. I would like to take the opportunity to learn Go, but the documentation I’ve seen thus far doesn’t make me feel good about it.