Buffalo v0.14.1 Released!

Mark Bates
Buffalo — Rapid Web Development in Go
3 min readMar 11, 2019

--

Please read through the notes to see what is new, what has been improved, and most importantly, what might be breaking changes for existing applications.

In addition to what is listed here, it is recommended that you read the CHANGELOG for a complete list of what has changed in v0.14.1.

How to Upgrade

Pre-built Binaries

The easiest solution is to download one of the pre-built binaries:
https://github.com/gobuffalo/buffalo/releases/tag/v0.14.1

Using Go Get

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

From Source

$ go get github.com/gobuffalo/buffalo
$ cd $GOPATH/src/github.com/gobuffalo/buffalo
$ git checkout tags/v0.14.1 -b v0.14.1
$ make install

Once you have an upgraded binary you can run the following command to attempt to upgrade your application from v0.14.0 to v0.14.1.

$ buffalo fix

Note: While we have done our best to make this update command work well, please understand that it might not get you to a complete upgrade depending on your application and its complexities, but it will get you pretty close.

What’s New

Smaller Resource Interface

The github.com/gobuffalo/buffalo#Resource interface has been made smaller. In previous versions the interface looked like:

type Resource interface {
List(Context) error
Show(Context) error
New(Context) error
Create(Context) error
Edit(Context) error
Update(Context) error
Destroy(Context) error
}

The interface has now been shorted to:

type Resource interface {
List(Context) error
Show(Context) error
Create(Context) error
Update(Context) error
Destroy(Context) error
}

The New(Context) error and Edit(Context) error methods on the interface have been removed, and are now optional.

This means that API resources now have a smaller foot print by not needing to implement the New and Edit end-points, that aren’t required by most APIs.

Web applications, can still implement those methods on their resource as they had previously done. When implemented, those end-points, will be added to the routing table as they did previously.

Additionally buffalo generate resource has been updated to not generate the New and Edit end-points for an API application, but it will continue to generate them for a web application.

This will not impact existing applications.

Buffalo Install Command

The buffalo build command has received a new alias, buffalo install. When buffalo install is called the application will be built as it does with a normal buffalo build command, but will install the application into GOPATH/bin using the go install command, instead of the go build command.

New Bindable Interface

There is now a new interface, github.com/gobuffalo/buffalo/binding.Bindable. When this interface is implemented on a type, it will be used when calling github.com/gobuffalo/buffalo#Context.Bind for that type, overriding any github.com/gobuffalo/buffalo/binding#Binder that may have been previously configured.

type Bindable interface {
Bind(*http.Request) error
}

This interface allows for a per-type level of binding.

type orbison struct {
bound bool
}
func (o *orbison) Bind(req *http.Request) error {
o.bound = true
return nil
}
func Test_Bindable(t *testing.T) {
r := require.New(t)
req := httptest.NewRequest("GET", "/", nil)
o := &orbison{}
r.False(o.bound)
r.NoError(Exec(req, o))
r.True(o.bound)
}

Improved Etag Support

This changes the Etag format from
Etag:323031392d30322d32352031363a32353a30362e333635333234343735202b3030303020555443206d3d2b313039392e373332333238373232
to the more sane Etag:1174efedab186000

Better CI Testing

While not a “feature” of Buffalo, during the development cycle for v0.14.1we revamped our CI testing to better test Windows, Mac, and Unix support as well as Go versions that we support.

The current matrix looks like this:

  • Windows, Mac, and Unix — Go 1.10.x
  • Windows, Mac, and Unix — Go 1.11.x GO111MODULES=off
  • Windows, Mac, and Unix — Go 1.11.x GO111MODULES=on
  • Integration tests via Docker

These changes apply to almost all projects in the github.com/gobuffaloorganization.

Breaking Changes

While not technically a “breaking” change, the minimum versions of Go required for Buffalo have changed, with the release of Go 1.12.

Supported versions are now:

  • Go >= 1.12.0
  • Go >= 1.11.5
  • Go >= 1.10.8

In addition to what is listed here, it is recommended that you read the CHANGELOG for a complete list of what has changed in v0.14.1.

Are you a company looking for Buffalo or Go training? The Gopher Guides want to help. We offer a variety of options, including In Person Training, Instructor Led Online Workshops, Consulting, and Support Contracts, and our self paced Online Video Learning.

Get your first 3 months of www.gopherguides.tv for 33% off! This offer is only good for a limited time, and a limited number, so act fast!

https://www.gopherguides.tv/?code=buffalo

--

--