October 31, 2020

Web Dev in Go

I’ve been developing Startyk in Go, and I’ve noticed a few things that really make me slower than I would like to be. I may be missing parts of the issue because of my lack of experience with Go and/or web development.

First, I’ve had to create all of the Postgres integrations by hand. I could have gone with an ORM, and just let it do it’s magic. I tried that before, and managing IDs which are not integers quickly becomes quite difficult. You also have to integrate how you want to handle migrations, and use external commands or create the functions to migrate using an external package, such as Golang migrate.

I have been using gin-gonic as a web framework, and while there is an option for templating, there is no asset pipeline integration. Maybe you’re expected to write your front-end as a separate project ? Or integrate the asset pipeline yourself, with projects such as Go sprockets? That makes an other integration you have to manage, leading you away from your core logic.

As a beginner, I’ve been able to find some posts with a folder structure to use, mostly for any generic Go project. I did not find anything clear for web applications. Again, I think that this is something that is related to my lack of experience, but having standards really help you get started.

Also, having to integrate with external tooling to get auto-reload working is a pain. I know that Revel has this feature, but since it does not offer database integration, it is still lacking in what I am looking for.

Right now, I want a framework that allows me to easily connect to a database, create the front-end from within the same repository in a straightforward way, meaning I can easily add CSS and/or Javascript frameworks. I want a framework that allows me to focus on the core of my application, not have to fiddle left and right to get things working. I want the most common cases, like saving an entity to a database, to be as simple as a Save function.

This is not easy to achieve, and I am not trying to make it look like Go is a bad language for that. But I have not had a good time creating a web application with it. However, I don’t have much more experience, and maybe it is even worse in other languages ?

For now though, I’ll take a little step back, and try out Rails (again). I’ll try to implement the same functionalities and see if it is easier, and a better fit for me. I know that it mostly does what I’m looking for, but there will be quite a learing curve…

Copyright Marin Gilles 2019-2022