I rebuilt my personal website using Gin Gonic

Posted on

Hello, I’m a Go noob who just remade his personal website (previously on Play Framework 1.5 using Java) with Gin Gonic. I wanted to talk about it to encourage web developers to try it too.

Did this to learn the go language, I only developed a script or two some years earlier and was desparately looking for an occasion to use this language again.

The code is here to check if you’re interested in gin web examples : https://github.com/eleby/rewan and the resulting website : https://www.rewan.dev/

I was, at first, disappointed by some things. Coming from old productivity frameworks like Laravel and Play, I was actually hoping for something similar, with shortcuts like route, configuration and translation files, which would then be automatically interpreted, and other classic web framework shortcuts.

However I quickly learnt that in go you can do some cool things very fast. Like managing a json configuration, setting its path in the run command and the id to use to run it, to make the command look for a file at that path and that id as the filename prefix, and attach the fetched conf to a configuration model struct. Or managing log files to copy and erase them when they reach a size limit. Or make a map on the server with values being deleted in X time, to use this map just like a cache storage.

Everything is simple in Go, and it applies to web development. Synthax is better, and allows for a way better productivity. It is modern and is future-proof. It makes it extremely simple to create concurrent threads. I was very surprised at it, goroutines are dope. Go is also fast which is always great for a website.

I actually enjoyed Gin and Go at a point where I developed things I didn’t plan on developing, just for the sake of using them a little more. Talk about a fanatic. I’m still planning on continuing this project.

Building a website with Go allows to have a very clean and readable code, without even having to need other folders than the website’s in the project since the framework is not even included in it. Controllers, models, views, resources : here you go. You can customize your folder architecture as you want and can keep it simple.

I didn’t have to use databases in my project but I think it’s safe to assume Go would be efficient there as well.

Few things I missed from Java tho, is the object oriented programming and java’s list variables, or the possibility to override functions. The documentation was lacking a bit too, I had more trouble finding answers to my questions by asking Google.

Go is awesome and should be considered in smaller/medium web projects. It might be better for big projects to use more popular frameworks just in case, to have access to more documentation and features, but I definitely am glad to see Go and Gin are more and more popular and already very efficient on the web side.

PS : Pls send me a blue gopher vinyl toy, can’t find one on the internet 🙁