Slide 1

Slide 1 text

Comparison of 10 Go web frameworks GoLang Marseille Meetup @FedirFr

Slide 2

Slide 2 text

Fedir RYKHTIK ● Building open source web since 2007 ○ Back-end developer ○ DevOps / SA ● CTO @AgenceStratis since 2015 ● Gopher

Slide 3

Slide 3 text

Tools and methodology used during analysis and comparison ● GitHub statistics : https://github.com/fedir/ghstat (Go) ● External dependencies counted via number of dependecies : ○ go get -u -v [packagename]/... ○ deplist (https://github.com/cespare/deplist) ● In this talk, frameworks listed in alphabetical order, by GitHub's owner key

Slide 4

Slide 4 text

1. astaxie/beego

Slide 5

Slide 5 text

Beego is an open source high performance web framework to build and develop your applications in the Go way.

Slide 6

Slide 6 text

astaxie/beego > quick facts ● URL: https://github.com/astaxie/beego ● Author : astaxie (Shanghai, China) ● Licence : Apache-2.0 ● Created at : 2012/02 ● Code : 1 200 kbytes ● Dependencies : 20 ● Stargazers : 14868 ● Contributors : > 231 ● Closed issues, % : 77.69 (~469 still open)

Slide 7

Slide 7 text

astaxie/beego > main features ● Full stack for Web & API ● MVC architecture ● RESTful support ● Modularity ● Auto API documents ● Annotation router ● Namespaces ● Powerful development tools

Slide 8

Slide 8 text

astaxie/beego > installation go get -u -v github.com/astaxie/beego/... go get -u github.com/beego/bee

Slide 9

Slide 9 text

astaxie/beego > bee usage bee is a tool for managing Beego framework. Usage: bee [command] [arguments] The commands are: new create a Beego application run run the app and start a Web server for development pack compress a Beego project into a single file api create an API Beego application (could autogenerate models) bale packs non-Go files to Go source files version show the bee, Beego and Go version generate source code generator migrate run database migrations

Slide 10

Slide 10 text

bee new beego-web (Generates conf, controllers, router, static, tests, views) bee api beego-api (Generates conf, controllers, docs, models, router, tests) bee run => http://localhost:8080/ astaxie/beego > usage examples

Slide 11

Slide 11 text

astaxie/beego > generated starter web beego-web/ ├── conf │ └── app.conf ├── controllers │ └── default.go ├── main.go ├── models ├── routers │ └── router.go ├── static │ ├── css │ ├── img │ └── js │ └── reload.min.js ├── tests │ └── default_test.go └── views └── index.tpl Code: https://github.com/fedir/gmm02/tree/master/beego-web

Slide 12

Slide 12 text

astaxie/beego > generated starter api beego-api/ ├── conf │ └── app.conf ├── controllers │ ├── object.go │ └── user.go ├── main.go ├── models │ ├── object.go │ └── user.go ├── routers │ └── router.go └── tests └── default_test.go Code: https://github.com/fedir/gmm02/tree/master/beego-api

Slide 13

Slide 13 text

astaxie/beego > code sample conf/app.conf appname = beego-web httpport = 8080 runmode = dev main.go func main() { beego.Run() } router.go func init() { beego.Router("/", &controllers.MainController{}) } controllers/default.go type MainController struct { beego.Controller } func (c *MainController) Get() { c.Data["Website"] = "beego.me" c.Data["Email"] = "[email protected]" c.TplName = "index.tpl" } views/index.tpl ...
Official website: {{.Website}} / Contact me:
...

Slide 14

Slide 14 text

astaxie/beego > notes ● "+" Interesting features ● "+" Good documentation ● "-" Big amount of not closed issues ● "-" Many issues not in English

Slide 15

Slide 15 text

astaxie/beego > notes > many not resolved bugs (!English)

Slide 16

Slide 16 text

astaxie/beego > when we'll use it ● Advanced / complex API ● Advanced web MVC site / application

Slide 17

Slide 17 text

astaxie/beego > ressources ● https://beego.me/docs/ ● https://stackoverflow.com/search?q=beego

Slide 18

Slide 18 text

2. gin-gonic/gin

Slide 19

Slide 19 text

Gin is a HTTP web framework written in Golang. If you need smashing performance and good productivity, get yourself some Gin.

Slide 20

Slide 20 text

gin-gonic/gin > quick facts ● URL: https://github.com/gin-gonic/gin ● Author : manucorporat (Spain) ● Licence : MIT ● Created at : 2014/06 ● Code : 300 kbytes ● Dependencies : 9 ● Stargazers : 16400 ● Contributors : > 146 ● Closed issues, % : 74.65 (~218 still open)

Slide 21

Slide 21 text

gin-gonic/gin > main features ● Simplicity :) ● Routing ● Custom Middlewares ● Validation

Slide 22

Slide 22 text

gin-gonic/gin > installation go get -u -v github.com/gin-gonic/gin

Slide 23

Slide 23 text

gin-gonic > examples // Ping test r.GET("/ping", func(c *gin.Context) { c.String(200, "pong") }) // Authorized group (uses gin.BasicAuth() middleware) // Same than: // authorized := r.Group("/") // authorized.Use(gin.BasicAuth(gin.Credentials{ // "foo": "bar", // "manu": "123", //})) authorized := r.Group("/", gin.BasicAuth(gin.Accounts{ "foo": "bar", // user:foo password:bar "manu": "123", // user:manu password:123 }))

Slide 24

Slide 24 text

gin-gonic > examples if v, ok := binding.Validator.Engine().(*validator.Validate); ok { v.RegisterValidation("bookabledate", bookableDate) } ... func bookableDate( v *validator.Validate, topStruct reflect.Value, currentStructOrField reflect.Value, field reflect.Value, fieldType reflect.Type, fieldKind reflect.Kind, param string, ) bool { if date, ok := field.Interface().(time.Time); ok { today := time.Now() if today.Year() > date.Year() || today.YearDay() > date.YearDay() { return false } } return true }

Slide 25

Slide 25 text

> notes ● "+" Fast ● "+" Simple ● "-" Many non-resolved issues

Slide 26

Slide 26 text

gin-gonic > when we'll use it ● API ● Custom application "from scratch" with fast flexible routing

Slide 27

Slide 27 text

gin-gonic > ressources ● Docs: https://github.com/gin-gonic/gin/blob/master/README.md ● Examples: https://github.com/gin-gonic/gin/tree/master/examples

Slide 28

Slide 28 text

3. go-aah/aah

Slide 29

Slide 29 text

aah is pronounced as ah (IPA: /ˈɑː/); it means delight, joyful pleasure. aah framework brings aah into Go application development and its maintenance.

Slide 30

Slide 30 text

go-aah/aah > quick facts ● URL: https://github.com/go-aah/aah ● Author: jeevatkm (Los Angeles, USA) ● Licence: MIT ● Created at: 2016/06 ● Code: 280 kbytes ● Dependencies : 33 ● Code coverage: 85% ● Stargazers: 269 ● Contributors: 3 ● Closed issues, %: 91.34 (~11 still open)

Slide 31

Slide 31 text

go-aah/aah > main features ● Powerful server features ● Routing ● Multi-Environment Configuration ● Parameters Auto Parse and Bind ● Security OOTB ● SPA and Mobile app support ● Event handling and dispatching ● Logging ● i18n Internationalization ● Error Handling ● Static File Delivery ● Docker and systemd files generation

Slide 32

Slide 32 text

go-aah/aah > installation go get -u -v aahframework.org/tools.v0/aah

Slide 33

Slide 33 text

go-aah/aah > aah usage aah is an [interactive] tool for managing aah framework. Usage: aah [global options] command [command options] [arguments...] Commands: new, n Create new aah 'web' or 'api' application (interactive) run, r Run aah framework application (supports hot-reload) build, b Build aah application for deployment list, l List all aah projects in GOPATH clean, c Cleans the aah generated files and build directory switch, s Switch between aah release and edge version update, u Update your aah to the latest release version on your GOPATH generate, g Generates boilerplate code, configurations, complement scripts (systemd, docker), etc. help, h Shows a list of commands or help for one command

Slide 34

Slide 34 text

go-aah/aah > aah usage example (web) $ aah new ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ aah framework v0.10 - https://aahframework.org ____________________________________________________________________ # Report improvements/bugs at https://github.com/go-aah/aah/issues # Welcome to interactive way to create your aah application, press ^C to exit :) Based on your inputs, aah CLI tool generates the aah application structure for you. Enter your application import path: github.com/fedir/gmm02/aah-web Choose your application type (web or api), default is 'web': web Choose your application View Engine (go, pug), default is 'go': go Choose your application Auth Scheme (form, basic), default is 'none': basic Choose your basic auth mode (file-realm, dynamic), default is 'file-realm': dynamic Choose your password hash algorithm (bcrypt, scrypt, pbkdf2), default is 'bcrypt': pbkdf2 Choose your session store (cookie or file), default is 'cookie': file Would you like to enable CORS ([Y]es or [N]o), default is 'N': Y Your aah web application was created successfully at '/Users/feo/go/src/github.com/fedir/gmm02/aah-web' You shall run your application via the command: 'aah run --importpath github.com/fedir/gmm02/aah-web' Go to https://docs.aahframework.org to learn more and customize your aah application.

Slide 35

Slide 35 text

go-aah/aah > generated starter web aah-web/ ├── aah.project ├── app │ ├── controllers │ │ └── app.go │ ├── init.go │ ├── models │ │ └── greet.go │ └── security │ ├── authentication_provider.go │ └── authorization_provider.go ├── config │ ├── aah.conf │ ├── env │ │ ├── dev.conf │ │ └── prod.conf │ ├── routes.conf │ └── security.conf ├── i18n │ └── messages.en ├── static │ ├── css │ │ └── aah.css │ ├── img │ │ ├── aah-framework-logo.png │ │ └── favicon.ico │ ├── js │ │ └── aah.js │ └── robots.txt └── views ├── common │ ├── error_footer.html │ ├── error_header.html │ ├── footer_scripts.html │ └── head_tags.html ├── errors │ ├── 404.html │ └── 500.html ├── layouts │ └── master.html └── pages └── app └── index.html Code: https://github.com/fedir/gmm02/tree/master/aah-web

Slide 36

Slide 36 text

go-aah/aah > generated starter api aah-api/ ├── aah.project ├── app │ ├── controllers │ │ └── app.go │ ├── init.go │ ├── models │ │ └── greet.go │ └── security │ ├── authentication_provider.go │ └── authorization_provider.go └── config ├── aah.conf ├── env │ ├── dev.conf │ └── prod.conf ├── routes.conf └── security.conf Code: https://github.com/fedir/gmm02/tree/master/aah-api

Slide 37

Slide 37 text

go-aah/aah > examples ● https://github.com/fedir/gmm02/tree/master/aah-api ● https://github.com/fedir/gmm02/tree/master/aah-web

Slide 38

Slide 38 text

go-aah/aah > when we'll use it ● Advanced / complex API ● Advanced web MVC site / application

Slide 39

Slide 39 text

go-aah/aah > notes ● "+" Interesting features ● "+" Good documentation ● "-" Project is not hosted on GitHub ● "-" Very few contributors at the moment

Slide 40

Slide 40 text

go-aah/aah > ressources ● https://docs.aahframework.org/ ● https://docs.aahframework.org/tutorials.html

Slide 41

Slide 41 text

4. go-chi/chi

Slide 42

Slide 42 text

Chi is a lightweight, idiomatic and composable router for building Go HTTP services

Slide 43

Slide 43 text

go-chi/chi > quick facts ● https://github.com/go-chi/chi ● Author : pkieltyka (Toronto, Canada) ● Licence : MIT ● Created at : 2015/10 ● Code : 200 kbytes ● Dependencies : 0 ● Stargazers : 3355 ● Contributors : 45 ● Closed issues, % : 91.94 (~15 still open)

Slide 44

Slide 44 text

go-chi/chi > main features ● Simplicity :) ● Routing ● Routing documentation autogeneration ● Logging ● Middlewares ● Static files server Used by : ● 99designs ● heroku ● cloudflare

Slide 45

Slide 45 text

go-chi/chi > installation go get -u -v github.com/go-chi/chi

Slide 46

Slide 46 text

go-chi/chi > examples r := chi.NewRouter() r.Use(middleware.RequestID) r.Use(middleware.Logger) r.Use(middleware.Recoverer) r.Use(middleware.URLFormat) r.Use(render.SetContentType(render.ContentTypeJSON)) r.Get("/", func(w http.ResponseWriter, r *http.Request) { w.Write([]byte("root.")) }) r.Get("/ping", func(w http.ResponseWriter, r *http.Request) { w.Write([]byte("pong")) }) r.Get("/panic", func(w http.ResponseWriter, r *http.Request) { panic("test") }) https://github.com/go-chi/chi/tree/master/_examples

Slide 47

Slide 47 text

go-chi/chi > notes ● "+" Nice and fast ● "-" Author stopped to work on it ?

Slide 48

Slide 48 text

go-chi/chi > when we'll use it ● REST API ● Frontal pre-routers before your existing applications / services ● Internal infrastructure

Slide 49

Slide 49 text

5. go-macaron/macaron

Slide 50

Slide 50 text

Macaron is a high productive and modular web framework in Go

Slide 51

Slide 51 text

go-macaron/macaron > quick facts ● URL: https://github.com/go-macaron/macaron ● Author : Unknwon (Boston, MA) ● Licence : Apache-2.0 ● Created at : 2014/07 ● Code : 155 kbytes ● Dependencies : 4 ● Stargazers : 2304 ● Contributors : 15 ● Closed issues, % : 90.48 (~12 still open)

Slide 52

Slide 52 text

go-macaron/macaron > main features ● Routing (suburl, routes combinations, nested group routers) ● Integrate with existing services ● Templating ● dynamically change template files at runtime, ● in-memory template ... ● Modular design (plugin/unplugin features) ● Dependency injection powered by inject ● Middlewares (captcha, piwik, gzip, sessions ...) ● i18n Used by: ● Grafana ● Gogs ● Peach ● Switch

Slide 53

Slide 53 text

go-macaron/macaron > installation go get -u -v gopkg.in/macaron.v1

Slide 54

Slide 54 text

go-macaron/macaron > examples > group routing m.Group("/books", func() { m.Get("/:id", GetBooks) m.Post("/new", NewBook) m.Put("/update/:id", UpdateBook) m.Delete("/delete/:id", DeleteBook) m.Group("/chapters", func() { m.Get("/:id", GetBooks) m.Post("/new", NewBook) m.Put("/update/:id", UpdateBook) m.Delete("/delete/:id", DeleteBook) }, MyMiddleware3, MyMiddleware4) }, MyMiddleware1, MyMiddleware2)

Slide 55

Slide 55 text

go-macaron/macaron > examples > i18n import ( "gopkg.in/macaron.v1" "github.com/go-macaron/i18n" ) func main() { m := macaron.Classic() m.Use(i18n.I18n(i18n.Options{ Langs: []string{"en-US", "zh-CN"}, Names: []string{"English", "简体中文"}, })) m.Get("/", func(locale i18n.Locale) string { return "current language is" + locale.Lang }) // Use in handler. m.Get("/trans", func(ctx *macaron.Context) string { return ctx.Tr("hello %s", "world") }) m.Run() }

Slide 56

Slide 56 text

go-macaron/macaron > notes ● "+" Cool interesting features ● "-" Few active contributors

Slide 57

Slide 57 text

go-macaron/macaron > when we'll use it ● Advanced web apps ● Advanced APIs

Slide 58

Slide 58 text

6. gobuffalo/buffalo

Slide 59

Slide 59 text

Buffalo is a Go web development eco-system. Designed to make the life of a Go web developer easier.

Slide 60

Slide 60 text

gobuffalo/buffalo > quick facts ● URL: https://github.com/gobuffalo/buffalo ● Author : markbates (Boston, MA) ● Licence : MIT ● Created at : 2014/10 ● Code : 325 kbytes ● Dependencies : 77 ● Stargazers : 2645 ● Contributors : 72 ● Closed issues, % : 89.75 (~50 still open)

Slide 61

Slide 61 text

gobuffalo/buffalo > main features ● Uses Gorilla toolkit for routes, sessions cookies ● Rails-like templating syntax, possibility to extend it's features ● Possibility to use html/template or Your own ● Buffalo toolbox ● Test templates for action, resources, model ● Hot Code Reload ● Webpack powered frontend pipeline (optional) ● Deep integration with pop/sqlx to handle database tasks ● Tasks / background workers (as rake in rails)

Slide 62

Slide 62 text

gobuffalo/buffalo > installation go get -u -v github.com/gobuffalo/buffalo/buffalo

Slide 63

Slide 63 text

gobuffalo/buffalo > cli buffalo help new Creates a new Buffalo application Usage: buffalo new [name] [flags] Flags: --api skip all front-end code and configure for an API server --bootstrap int specify version for Bootstrap [3, 4] (default 3) --ci-provider string specify the type of ci file you would like buffalo to generate [none, travis, gitlab-ci] (default "none") --db-type string specify the type of database you want to use [postgres, mysql, cockroach] (default "postgres") --docker string specify the type of Docker file to generate [none, multi, standard] (default "multi") -f, --force delete and remake if the app already exists -h, --help help for new --skip-pop skips adding pop/soda to your app --skip-webpack skips adding Webpack to your app --skip-yarn use npm instead of yarn for frontend dependencies management --vcs string specify the Version control system you would like to use [none, git, bzr] (default "git") -v, --verbose verbosely print out the go get commands --with-dep adds github.com/golang/dep to your app

Slide 64

Slide 64 text

gobuffalo/buffalo > examples buffalo new buffaloweb buffalo new buffaloapi --api

Slide 65

Slide 65 text

gobuffalo/buffalo > generated starter web buffalo-web/ ├── Dockerfile ├── README.md ├── actions │ ├── actions_test.go │ ├── app.go │ ├── home.go │ ├── home_test.go │ └── render.go ├── assets │ ├── css │ ├── images │ └── js ├── database.yml ├── grifts │ ├── db.go │ └── init.go ├── inflections.json ├── locales │ └── all.en-us.yaml ├── main.go ├── models │ ├── models.go │ └── models_test.go ├── node_modules [624 entries exceeds filelimit, not opening dir] ├── package.json ├── public │ ├── assets │ └── robots.txt ├── templates │ ├── _flash.html │ ├── application.html │ └── index.html ├── webpack.config.js └── yarn.lock Code: https://github.com/fedir/gmm02/tree/master/buffalo-web

Slide 66

Slide 66 text

gobuffalo/buffalo > generated starter api buffalo-api/ ├── Dockerfile ├── README.md ├── actions │ ├── actions_test.go │ ├── app.go │ ├── home.go │ ├── home_test.go │ └── render.go ├── database.yml ├── grifts │ ├── db.go │ └── init.go ├── inflections.json ├── main.go └── models ├── models.go └── models_test.go Code: https://github.com/fedir/gmm02/tree/master/buffalo-api

Slide 67

Slide 67 text

gobuffalo/buffalo > notes ● "+" Complete and functional ● "+" Awesome starter generators ● "+" Good managed and active community ● "-" Lot's of external dependencies

Slide 68

Slide 68 text

gobuffalo/buffalo > when we'll use it ● Advanced / complex complete web sites / applications ● Advanced / complex API

Slide 69

Slide 69 text

gobuffalo/buffalo > ressources ● https://gobuffalo.io/en ● https://godoc.org/github.com/gobuffalo/buffalo ● https://gobuffalo.io/en/docs/plugins

Slide 70

Slide 70 text

7. gohugoio/hugo

Slide 71

Slide 71 text

"The world’s fastest framework for building websites." Hugo is one of the most popular open-source static site generators.

Slide 72

Slide 72 text

gohugoio/hugo > quick facts ● URL: https://github.com/gohugoio/hugo ● Author : spf13 (NYC, USA) ● Licence : Apache-2.0 ● Created at : 2013/07 ● Code : 1 920 kbytes ● Dependencies : 112 ● Stargazers : 24879 ● Contributors : 446 ● Closed issues, % : 91.75 (~229 still open)

Slide 73

Slide 73 text

gohugoio/hugo > main features ● Fast ● Unlimited content types, taxonomies, menus, API-driven content ● Markdown powered ● i18n ● Outputs content in AMP / JSON / Custom format ● Many themes ● Good documentation ● Generated site could be hosted anywhere ● Lipi or Netlify frontends for webmaster's graphical GUI (Optional)

Slide 74

Slide 74 text

gohugoio/hugo > migrations ● From ○ WordPress ○ Joomla ○ Drupal ○ DokuWiki ○ Tumblr ○ Blogger ○ Jekyll ○ ...

Slide 75

Slide 75 text

gohugoio/hugo > installation go get github.com/magefile/mage go get -d github.com/gohugoio/hugo cd ${GOPATH:-$HOME/go}/src/github.com/gohugoio/hugo mage vendor mage install

Slide 76

Slide 76 text

gohugoio/hugo > hugo cli hugo is the main command, used to build your Hugo site. Usage: hugo [flags] hugo [command] Available Commands: benchmark Benchmark Hugo by building a site a number of times. check Contains some verification checks config Print the site configuration convert Convert your content to different formats env Print Hugo version and environment info gen A collection of several useful generators. help Help about any command import Import your site from others. list Listing out various types of content new Create new content for your site server A high performance webserver version Print the version number of Hugo Flags (only some of them, as they are quite numerous): -b, --baseURL string hostname (and path) to the root --cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/ --cleanDestinationDir remove files from destination not found in static directories --config string path to config file -c, --contentDir string filesystem path to content dir --debug debug output -d, --destination string filesystem path to write files to --i18n-warnings print missing translations -l, --layoutDir string filesystem path to layout dir -t, --theme string theme to use --themesDir string filesystem path to themes dir -w, --watch watch filesystem for changes and recreate as needed

Slide 77

Slide 77 text

gohugoio/hugo > examples hugo new site hugo-web hugo server -D => http://localhost:1313/.

Slide 78

Slide 78 text

gohugoio/hugo > generated site hugo-web/ ├── archetypes │ └── default.md ├── config.toml ├── content ├── data ├── layouts ├── static └── themes Code: https://github.com/fedir/gmm02/tree/master/hugo-web

Slide 79

Slide 79 text

gohugoio/hugo > notes ● "+" Perfect for building of static sites ● "-" Not really a Go web framework, but rather sites generator, written in Go

Slide 80

Slide 80 text

gohugoio/hugo > when we'll use it ● Static web sites / PWA / ...

Slide 81

Slide 81 text

gohugoio/hugo > ressources ● https://gohugo.io/documentation/ ● https://stackoverflow.com/questions/tagged/hugo?sort=votes

Slide 82

Slide 82 text

8. kataras/iris

Slide 83

Slide 83 text

Iris is a fast, simple yet fully featured and efficient web framework for Go.

Slide 84

Slide 84 text

kataras/iris > quick facts ● URL: https://github.com/kataras/iris ● Author : kataras (Greece) ● Licence : BSD-3-Clause ● Created at : 2016/01 ● Code : 970 kbytes ● Dependencies : 62 ● Stargazers : 9880 ● Contributors : 34 ● Closed issues, % : 99.38(~5 still open)

Slide 85

Slide 85 text

kataras/iris > main features ● Routing (group, wildcards) ● Middlewares support ● Basic Authentication, OAuth2, JWT ● Multiple templating engines (via external deps) ● Websockets ● Sessions ● Caching ● I18N

Slide 86

Slide 86 text

kataras/iris > multiple templating systems 6 template engines are supported : ● html/template ● amber (github.com/eknkc/amber) ● django(github.com/flosch/pongo2) ● handlebars(github.com/aymerick/raymond) ● pug (github.com/Joker/jade) ● markdown (github.com/russross/blackfriday)

Slide 87

Slide 87 text

kataras/iris > installation go get -u -v github.com/kataras/iris

Slide 88

Slide 88 text

kataras/iris > examples package main import ( "github.com/kataras/iris" "github.com/kataras/iris/middleware/logger" "github.com/kataras/iris/middleware/recover" ) func main() { app := iris.New() app.Logger().SetLevel("debug") app.Use(recover.New()) app.Use(logger.New()) app.Handle("GET", "/", func(ctx iris.Context) { ctx.HTML("

Welcome

") }) app.Get("/ping", func(ctx iris.Context) { ctx.WriteString("pong") }) app.Get("/hello", func(ctx iris.Context) { ctx.JSON(iris.Map{"message": "Hello Iris!"}) }) app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed)) }

Slide 89

Slide 89 text

kataras/iris > notes ● "+" Interesting architecture ● "+" Good social promotion by authors ● "-" Many external dependencies ● "-" Critics on Web about git history rewrites and issues removal

Slide 90

Slide 90 text

kataras/iris > when we'll use it ● Custom web applications

Slide 91

Slide 91 text

kataras/iris > ressources ● https://docs.iris-go.com/ ● https://godoc.org/github.com/kataras/iris ● https://github.com/kataras/iris#iris-starter-kits ● https://github.com/kataras/iris/tree/master/_examples

Slide 92

Slide 92 text

9. labstack/echo

Slide 93

Slide 93 text

High performance, extensible, minimalist Go web framework

Slide 94

Slide 94 text

● URL: https://github.com/labstack/echo ● Author : vishr (San Francisco) ● Licence : MIT ● Created at : 2015/03 ● Code : 230 kbytes ● Dependencies : 8 ● Stargazers : > 10000 ● Contributors : > 100 ● Closed issues, % : 85.90 (~ 106 still open) labstack/echo > quick facts

Slide 95

Slide 95 text

labstack/echo > main features ● Routing (RESTful APIs; Group APIs) ● Extensible middlewares (at root, group or route level) ● Data binding for JSON, XML and form payload ● Handy functions to send variety of HTTP responses ● Centralized HTTP error handling ● Template rendering with any template engine ● Custom logging formats ● Automatic TLS via Let’s Encrypt ● HTTP/2 support

Slide 96

Slide 96 text

labstack/echo > installation go get -u -v github.com/labstack/echo/...

Slide 97

Slide 97 text

labstack/echo > examples package main import ( "net/http" "github.com/labstack/echo" "github.com/labstack/echo/middleware" ) func main() { e := echo.New() e.Use(middleware.Logger()) e.Use(middleware.Recover()) e.GET("/", hello) e.Logger.Fatal(e.Start(":1323")) } func hello(c echo.Context) error { return c.String(http.StatusOK, "Hello, World!") }

Slide 98

Slide 98 text

labstack/echo > notes ● "+" Fast ● "+" Pragmatic ● "-" Many non-resolved issues

Slide 99

Slide 99 text

labstack/echo > when we'll use it ● API & web apps, which will require high performance

Slide 100

Slide 100 text

10. revel/revel

Slide 101

Slide 101 text

A high-productivity web framework for the Go language.

Slide 102

Slide 102 text

revel/revel > quick facts ● URL: https://github.com/revel/revel ● Author : robfig (New York) ● Licence : MIT ● Created at : 2011/12 ● Code : 420 kbytes ● Dependencies : 22 ● Stargazers : 9708 ● Contributors : 120 ● Closed issues, % : 92.29 (~63 still open)

Slide 103

Slide 103 text

revel/revel > main features ● Routing, parameter parsing, validation ● Filters: middlewares ● Interceptors ● Session/flash ● Templating, caching ● Job running ● Testing framework ● I18n ● Synchronous ● Stateless

Slide 104

Slide 104 text

revel/revel > interceptors An Interceptor is a function that is invoked by the framework BEFORE or AFTER an action invocation. It allows a form of Aspect Oriented Programming, which is useful for some common concerns such as: ● Request logging ● Error handling ● Statistics logging ● Authentication handling

Slide 105

Slide 105 text

revel/revel > filters Filters are the middleware and are individual functions that make up the request processing pipeline. They execute all of the framework’s functionality.

Slide 106

Slide 106 text

revel/revel > installation go get -u -v github.com/revel/cmd/revel

Slide 107

Slide 107 text

revel/revel > revel cli revel command [arguments] The commands are: new create a skeleton Revel application run run a Revel application build build a Revel application (e.g. for deployment) package package a Revel application (e.g. for deployment) clean clean a Revel application's temp files test run all tests from the command-line version displays the Revel Framework and Go version

Slide 108

Slide 108 text

revel/revel > generated starter revel-web/ ├── README.md ├── app │ ├── controllers │ │ └── app.go │ ├── init.go │ └── views │ ├── App │ │ └── Index.html │ ├── debug.html │ ├── errors │ │ ├── 404.html │ │ └── 500.html │ ├── flash.html │ ├── footer.html │ └── header.html ├── conf │ ├── app.conf │ └── routes ├── messages │ └── sample.en ├── public │ ├── css │ │ └── bootstrap-3.3.6.min.css │ ├── fonts │ │ ├── glyphicons-halflings-regular.ttf │ │ ├── glyphicons-halflings-regular.woff │ │ └── glyphicons-halflings-regular.woff2 │ ├── img │ │ └── favicon.png │ └── js │ ├── bootstrap-3.3.6.min.js │ └── jquery-2.2.4.min.js └── tests └── apptest.go Code: https://github.com/fedir/gmm02/tree/master/revel-web

Slide 109

Slide 109 text

revel/revel > examples https://github.com/revel/examples

Slide 110

Slide 110 text

revel/revel > notes ● "+" Complete ● "+" Good documentation ● "+/-" Aged ● "+" Still interesting concepts

Slide 111

Slide 111 text

revel/revel > when we'll use it ● Medium & complex web Apps

Slide 112

Slide 112 text

revel/revel > ressources ● http://revel.github.io/manual/index.html ● http://revel.github.io/manual/filters.html ● http://revel.github.io/manual/interceptors.html ● https://github.com/revel/examples ● https://stackoverflow.com/questions/tagged/revel?sort=votes

Slide 113

Slide 113 text

All frameworks

Slide 114

Slide 114 text

Classification

Slide 115

Slide 115 text

All frameworks > Classification High performance light frameworks https://github.com/labstack/echo https://github.com/go-chi/chi https://github.com/gin-gonic/gin All-in-one frameworks https://github.com/gobuffalo/buffalo https://github.com/kataras/iris https://github.com/astaxie/beego https://github.com/revel/revel https://github.com/go-aah/aah https://github.com/go-macaron/macaron Static sites generators https://github.com/gohugoio/hugo

Slide 116

Slide 116 text

Comparison & ranking I II III

Slide 117

Slide 117 text

all frameworks > statistics Name License Created at Stargazers Contributors Open issues Closed issues, % astaxie/beego Apache-2.0 2012/02 14868 231 469 77.69 gin-gonic/gin MIT 2014/06 16400 146 218 74.65 go-aah/aah MIT 2016/06 269 3 11 91.34 go-chi/chi MIT 2015/10 3355 45 15 91.94 go-macaron/macaron Apache-2.0 2014/07 2304 15 12 90.48 gobuffalo/buffalo MIT 2014/10 2645 72 50 89.75 gohugoio/hugo Apache-2.0 2013/07 24879 446 229 91.75 kataras/iris BSD-3-Clause 2016/01 9880 34 5 99.38 labstack/echo MIT 2015/03 10031 101 106 85.90 revel/revel MIT 2011/12 9708 120 63 92.29 Details : https://github.com/fedir/ghstat/blob/master/stats/go_frameworks.csv

Slide 118

Slide 118 text

all frameworks > ranking by number of dependencies Name Placement by number of dependencies go-chi/chi 1 go-macaron/macaron 2 labstack/echo 3 gin-gonic/gin 4 revel/revel 5 go-aah/aah 6 kataras/iris 7 astaxie/beego 8 gobuffalo/buffalo 9 gohugoio/hugo 10

Slide 119

Slide 119 text

all frameworks > ghstat ranking Name ghstat placement by popularity ghstat placement by age ghstat placement by total commits ghstat placement by total tags ghstat placement by top 10 contributor s followers ghstat placement by closed issues percentage ghstat placement by commits by day ghstat placement by active forkers column ghstat overall placement gohugoio/hugo 1 8 1 2 3 4 1 4 1 gobuffalo/buffalo 8 5 3 3 5 7 3 1 2 kataras/iris 5 2 4 5 9 1 2 10 3 labstack/echo 4 4 6 1 7 8 5 5 4 astaxie/beego 3 9 2 4 1 9 4 8 5 go-chi/chi 7 3 10 8 6 3 9 3 6 gin-gonic/gin 2 7 7 9 4 10 6 7 7 revel/revel 6 10 5 6 8 2 8 6 8 go-aah/aah 10 1 8 10 10 5 7 2 9 go-macaron/macaron 9 6 9 7 2 6 10 9 10 Details : https://github.com/fedir/ghstat/blob/master/stats/go_frameworks.csv

Slide 120

Slide 120 text

Merci :) @FedirFR