Go write a web app! Five interesting Go web frameworks

Go is such a new language that even more established frameworks can have interesting quirks. One of the key issues learning the Go framework is the availability of useful documentation. Unfortunately, Go framework maintainers don’t always prioritize writing the documentation necessary to get new programmers up to speed on their frameworks. The five frameworks below, however, have usable documentation and are straightforward to use.

go_coffeeGo is such a new language that even more established frameworks can have interesting quirks. One of the key issues learning the Go framework is the availability of useful documentation. Unfortunately, Go framework maintainers don’t always prioritize writing the documentation necessary to get new programmers up to speed on their frameworks. The five frameworks below, however, have usable documentation and are straightforward to use.

1. Martini

Getting started with Martini is painless (which may explain why it's one of the most popular Go frameworks). The framework was designed to be simple and work with other Go packages—or, as the maintainers describe it, a "classy" web framework. If you’re just getting started with Go, Martini may be the best framework to use for your projects. Out of the box, Martini has the features you’ll need on most early projects. It’s also modular, which means adding functionality is easy. Keep in mind that Martini isn't idiomatic Go, though; it's not wrong, but you may face some trouble switching back and forth.

# Martini looks a little like Sinatra

m.Get("/", func() string {
  return "hello world" // HTTP 200 : "hello world"
})

2. Gorilla

Technically speaking, Gorilla is a web toolkit, rather than a web framework. However, packages within Gorilla will make your projects easier to launch. Gorilla Mux, for example, is an especially powerful URL router and dispatcher. Gorilla also has packages for saving sessions, authenticating and encrypting cookies and websockets. In addition to the documentation on the Gorilla site, there's a strong community able to provide some support. You can also easily use Gorilla in conjunction with other frameworks.

# Mux isn't a web framework, but it has tools for routing, sessions
# and other things you need to make a web app. 

r := mux.NewRouter()
r.HandleFunc("/", HomeHandler)
r.HandleFunc("/products", ProductsHandler)
r.HandleFunc("/articles", ArticlesHandler)
http.Handle("/", r)

3. Echo

If you’ve used Echo in the past, you may not be a big fan—the maintainers rebased the whole code base recently. Annoying as that may be, the framework has a lot to offer, especially if you’re coming to Echo fresh. Echo’s performance is impressive and handles garbage collection efficiently. If speed is a concern on your project, Echo is your best option. You may find a few points in the Echo documentation listed as a "work in progress," but Echo’s maintainers have posted numerous recipes to get programmers going.

# Echo also looks kind of like Sinatra. I'm sensing a pattern. 

blog := echo.New()
blog.Use(mw.Logger())
blog.Use(mw.Recover())

hosts["blog.localhost:1323"] = blog

blog.Get("/", func(c *echo.Context) error {
   return c.String(http.StatusOK, "Blog")
})

4. web.go

web.go claims to be "the simplest way to write web applications in Go." Whether or not that’s accurate, web.go is one of the easiest web frameworks for writing backend web services. If you’ve worked with a higher-level web framework like web.py or Sinatra, you can get up to speed with web.go almost immediately. While web.go’s quickstart guide may be enough for more experienced programmers, the framework’s tutorial and API docs are thorough.

func hello(val string) string { 
    return "hello " + val 
} 

func main() {
    web.Get("/(.*)", hello)
    web.Run("0.0.0.0:9999")
}

5. Beego

Looking for a framework that guarantees high performance? Beego is worth trying out. The framework is designed for full-stack web development and it's modular. There’s also the bee tool within Beego as a bonus. The Bee tool auto-compiles, reloads, tests and deploys Beego applications efficiently. Beego has a huge amount of documentation and demos, though some are difficult to understand the first time through—set aside a little extra time for the documentation. You can also see a number of web applications using Beego in production.

If you’re looking for a more specialized web framework, check out Awesome Go’s in-depth list of actively maintained frameworks and other tools. Open source contributors are launching new Go projects every day, so make sure you stay up to date—you may even find a Go library you can contribute to yourself.

What to do next:
  1. Try Honeybadger for FREE
    Honeybadger helps you find and fix errors before your users can even report them. Get set up in minutes and check monitoring off your to-do list.
    Start free trial
    Easy 5-minute setup — No credit card required
  2. Get the Honeybadger newsletter
    Each month we share news, best practices, and stories from the DevOps & monitoring community—exclusively for developers like you.
    author photo

    Starr Horne

    Starr Horne is a Rubyist and Chief JavaScripter at Honeybadger.io. When she's not neck-deep in other people's bugs, she enjoys making furniture with traditional hand-tools, reading history and brewing beer in her garage in Seattle.

    More articles by Starr Horne
    Stop wasting time manually checking logs for errors!

    Try the only application health monitoring tool that allows you to track application errors, uptime, and cron jobs in one simple platform.

    • Know when critical errors occur, and which customers are affected.
    • Respond instantly when your systems go down.
    • Improve the health of your systems over time.
    • Fix problems before your customers can report them!

    As developers ourselves, we hated wasting time tracking down errors—so we built the system we always wanted.

    Honeybadger tracks everything you need and nothing you don't, creating one simple solution to keep your application running and error free so you can do what you do best—release new code. Try it free and see for yourself.

    Start free trial
    Simple 5-minute setup — No credit card required

    Learn more

    "We've looked at a lot of error management systems. Honeybadger is head and shoulders above the rest and somehow gets better with every new release."
    — Michael Smith, Cofounder & CTO of YvesBlue

    Honeybadger is trusted by top companies like:

    “Everyone is in love with Honeybadger ... the UI is spot on.”
    Molly Struve, Sr. Site Reliability Engineer, Netflix
    Start free trial