DEV Community

Cover image for My Go Toolkit to Build a Frameworkless App

My Go Toolkit to Build a Frameworkless App

Boris Jamot ✊ / on January 28, 2019

A few months ago, I started my journey from PHP to Go on a new app in my company. Some 3 months after, I posted another Article on DEV talking abo...
Collapse
 
ladydascalie profile image
Benjamin Cable • Edited

For anyone else reading this: do not use the satori/uuid package.

It has a number of very concerning flaws, with this one being the worst:

Please instead use: github.com/gofrs/uuid


Now on to the topic:

You want to build a Frameworkless App, but you use Gin, which is a framework. This is quite the incompatible premise, would you not say?

I would encourage using gorilla/mux for small niceties on top of the standard library, I personally think it's enough.

Gin introduces too much magic and special "Gin only" behaviour and I personally am not a fan of that.

Collapse
 
exadra37 profile image
Paulo Renato

You want to build a Frameworkless App, but you use Gin, which is a framework. This is quite the incompatible premise, would you not say?

I though exactly the same ;)

For anyone else reading this: do not use the satori/uuid package.
It has a number of very concerning flaws, with this one being the worst:

github.com/satori/go.uuid/issues/73

Please instead use: github.com/gofrs/uuid

Thanks for the security alert :)

Collapse
 
biros profile image
Boris Jamot ✊ /

Thanks for the security alert on using satori/go.uuid.

Regarding gin-gonic, I don't use it as a framework, but just as a router.

Collapse
 
jaakidup profile image
Jaaki

I'd get rid of gin, go really doesn't need frameworks.
There are many people who think you need a framework as soon as you start a new language, but forget that idea with go.

If you're using it just for the router, you could use julien schmidt directly.
I would suggest my own, but I don't think it's ready yet. I need to make sure it's bombproof first.

PS. I also switched from PHP, never looked back.

Happy Coding

Collapse
 
biros profile image
Boris Jamot ✊ /

I switched from gin router to httprouter. It's enough for my needs.
I also dropped viper to use builtin env var funcs.
I also dropped zap to use zerolog which is more simple.
In my toolbox, I gave a chance to gorm which a little ORM for Go.

I have to publish a new edition of my Go toolbox.

Collapse
 
jaakidup profile image
Jaaki

Nice, yes, simplicity is key for me.

Collapse
 
ladydascalie profile image
Benjamin Cable • Edited

I really like it too! However I've been using gorilla/mux on prod for a long time now and it's never been an issue, I really appreciate it's "battle-hardened" quality and feel.

It's one of the rare libraries I feel fully confident with because it's proved itself time and time again.

Not saying this isn't true of chi, just that, that wasn't the choice we made for production back then, so I can't compare it at that level yet.

Collapse
 
bballenn profile image
bballenn

Thanks for sharing these packages 📦 I’ve been making a few side projects with Go but always spent too much time trying to find the “right” libraries to use.

Collapse
 
lucasgeeksinthewood profile image
Lucas Brown

My twin brother started using an open-source project called the SaaS Startup Kit . It is an open-source project of Go code to bootstrap your software-as-a-service startup.

gitlab.com/geeks-accelerator/oss/s...

The goal of this project is to provide a proven approach for building new SaaS that reduces the repetitive tasks in getting a new software service launched to production that can easily be scaled and ready to onboard enterprise clients.

Collapse
 
lysofdev profile image
Esteban Hernández

Great post! Do you have a recommendation on handling dependencies in your Go projects? This has probably been the biggest source of confusion in my experience with Go.

Collapse
 
biros profile image
Boris Jamot ✊ /

Hi Esteban!

I gave a chance to go mod even if the support is still experimental in the 1.11, because it should be stable in the release 1.12.

I bet it will be the future of Go dependency management and will replace go dep.

I found out that go mod is on the good way to be a solid dependency manager for Go. You just have to init your go.mod by typing go mod init and then, every time you'll type go get something, it will add it to your project's dependencies.

It's also a good way to organize your code in modules.

Collapse
 
ifenna__ profile image
Ifenna

This is great stuff. Thanks for sharing! Just starting out with Go myself.

Collapse
 
suciptoid profile image
Sucipto

+1 for chi

Collapse
 
dimensi0n profile image
Erwan ROUSSEL

I created an authentication package here : github.com/dimensi0n/persona (Cookies way only)

Collapse
 
peteraba profile image
Peter Aba

At a first glance it seems very similar to echo which I use for personal projects. I'll try to check how they differ, but if you know, please fill me in.

Collapse
 
theodesp profile image
Theofanis Despoudis

I would also try to use the official MongoDB driver from now on:
github.com/mongodb/mongo-go-driver

Collapse
 
biros profile image
Boris Jamot ✊ /

When I started learning Go in September of 2018, it wasn't ready for production.
Do you know if it's ready now ?

Collapse
 
thammuio profile image
Suri Nuthalapati

good one!!