Why I love go?

There are quite a few reasons, but by far my most favorite feature is

Executable binaries

Want to a quick CLI for your application, include a folder in your cmd/ folder and just like that you have a binary with all dependencies and files in a single file. There is no need to even include go in the final Dockerfile. Just today, we ran into a small problem of running migrations on the database via Github actions as it the database was on a private network. Took me about thirty minutes to create a new cmd to run migrations and include the binary in the final docker image. No need to change how we were running migrations at all. In development we still use goose to build migrations. The ease with which, that problem was solved was just exhilarating.

Errors as values

This one is a quite polarizing topic, initially I was unsure how I felt about them. Coming from the JavaScript world of exceptions, it felt alien.

Until I had to build a quick prototype, I was still new to go so I decided to use Nodejs. As I tried to run my prototype, I kept running into bugs that would halt the program, probably due to skill issues. At the time I just thought, it was a natural arc of building programs that you are unsure of. It was until, I built the next prototype in go. The errors were obvious as I was programming. You have to explicitly decide what to do with errors at each step. The funny thing was, as I tried to run this prototype, I kept waiting for it to panic. But it did not happen at all. There obviously were bugs, but the program was running. At first I thought I'd just mastered programming :D, I went back to Nodejs to see what was different, I realized that in both languages the same errors were handled, the only difference was that the errors were obvious in go. So I'm happy to do this as much as needed

if err != nil {
    return nil, err
}

If it means, I don't have to guess what went wrong and where afterwards.

Tooling

My final favorite feature of go is the tooling. Once I've installed go, I'm good to go. All I had to do was add gofumpt in my lsp config.

lspconfig.gopls.setup({
    settings = {
        gopls = {
            gofumpt = true
        }
    }
})

I don't agree with all the formatting rules, but I think it still better than bikshedding over them. It's annoying for a while but you'll be surprised with what you can get used to.

Not to mention the ease with which you can write tests. Especially coming from the JavaScript world of linters, prettiers and testing libraries. Note that, I don't hate JavaScript, I think it's awesome in what it can do in the browser as a scripting language.