gobuffalo

Building a framework in Go is not an easy thing to do. It has little to do with the language itself, rather it's about the community approach to frameworks in general. We are about people who spend half of their time writing "if error is not nil" checks. Despite all that, a man by the name of Mark Bates chose this path and decided to create something that might revolutionize web development in Go. Let's dive into GoBuffalo, one of the most hyped Go-related things.

What makes GoBuffalo an interesting project is a way it is constructed. It's not a self-contained repository, independent of anything, but rather a small glue that sticks multiple libraries aimed to perform specific tasks. Each of them can be used on its own, and together they sum up to a pretty powerful tool.

Building blocks

Bates recognizes that a whole lot of the buffalo is done under the covers by various libraries, so he uses a quote of Izaak Newton (If I have seen further it is by standing on the shoulders of giants.) and lists all the giants that allow the project to be what it is today. It's a little bit funny and cocky that he lists some of his own work as giants, but in all fairness, they are of a very high quality, and I'm not going to blame him for that. When you do a good job, you deserve the recognition and deserve to feel proud of yourself.

A list of building blocks include:

  • envy (working with ENV), packr (binding static assets), plush (templating system) from github/buffalo itself,
  • gorilla/mux for HTTP routing
  • sqlx for SQL connection
  • grift (a task runner), pop (wrapper around sqlx) from Mark Bates himself,
  • multiple packages from anko, scriptable interpreter written in Go
  • obviously, pkg/errors from Dave Cheney
  • cobra for building CLI tools
  • and more...

Taking a brief look on those things listed above made me realize that most of them deserve some time and attention, not only to fully understand their impact on Buffalo but also that they can be very useful in other projects as well.

Getting started

Getting started with Buffalo is so easy, that it's actually surprising that your web application is up and running so quickly. To create a base of your project all you need to is go get the tool itself:

go get -u github.com/gobuffalo/buffalo/buffalo

Then initialize a project with a chosen name:

buffalo new project_name

After a couple of minutes (mainly due to npm install fetching half of the internet as dependencies) you can spin it off:

buffalo dev

Your page is available under http://localhost:3000 and you can start hacking around.

First impressions

What struck me first is that the documentation page is really impressive and covers most of the things you'd be doing with the project. It's clean, well organized and easy to understand, so I recommend reading it cover-to-cover. It will make working with GoBuffalo much easier.

At the same time, you must realize, that GoBuffalo is a very young project, with its first GitHub commit on November 23rd, 2016. At the time of me writing this post, it's just eight months old! Therefore you should be prepared that some things are still missing, there might be some silly bugs, the docs might be a bit off. If you see anything like this, don't hesitate to create pull requests, Mark appreciates even the smallest ones as No PR is too small.

Speaking of the author, I happened to see him live once, on GoLab conference this year talking about the fear and uncertainty of people in software development business. Later that day he had a talk about GoBuffalo which I missed and now I totally regret it. Anyway, Mark seems like one of the most positive people in the community and listening to him is always fun. For instance, try listening to GoTime podcast with him without laughing - it's just too hard. What impresses me the most, however, is that he is not just smiles and laughs - he works hard and will answer any question about Buffalo, just look at #buffalo channel on Gophers Slack.

Last but not least, I think that GoBuffalo is worth a look, because it's not only hyped by some random dudes in the Go community. It's also appreciated by Brian Ketelsen, an organizer of Gophercon. In fact, he recently started a Gophercon 18 project o GitHub using GoBuffalo, which means that most likely the official page of the largest Go conference will be using this tool. I don't know about you, but I don't want to be late to the party and realize that everybody is using this with me not knowing it at all.

What next?

I'll probably spend some time discovering GoBuffalo and its giants, I think lots of interesting content is on its way.