Skip to content

Instantly share code, notes, and snippets.

@MalloZup
Last active March 10, 2021 10:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MalloZup/aee6845fc3090696642828f7cc345685 to your computer and use it in GitHub Desktop.
Save MalloZup/aee6845fc3090696642828f7cc345685 to your computer and use it in GitHub Desktop.

Comparative study between different golang framework

2021 March

This document take insiration by folowing sources:

howtos:

Framework compared:

go chi:

Pro:

  • it isn't a framework
  • its compatible with the stdlib so I could swap it out at any time.
  • zero external vendor dependencie
  • chi is built on the new context package introduced in Go 1.7 to handle signaling, cancelation and request-scoped values across a handler chain.

go gin

contra:

  • unidiomatic golang
  • not compatible with stdlib
  • Gin breaks the standard handler signature, and its Context is inexplicably incompatible with context.Context
  • it is a framework

pro:

  • performance
@dirkmueller
Copy link

if the only pro for "go gin" is performance then we shouldn't use it. from my limited experience with gin I find the session and CSRF handling pretty minimal. if other options have better implementations we should consider that.

@MalloZup
Copy link
Author

MalloZup commented Mar 10, 2021

regarding session handling:

https://github.com/gorilla/sessions

the rationale behind chi and mux is that they are "pluggable" web toolkit, so if we choose one of those routers, for other components we can pick up or plug others, whereas go gin it is a framework within it all logic, afaik I can tell.

see https://www.gorillatoolkit.org/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment