NOTE: Please read https://github.com/golang/go/wiki/Modules to understand more about Go Modules before using them.
Enabling Go Module Support
The support for Go Modules in "Buffalo" packages is experimental, as are Go Modules (as of
v1.11.x). To "opt-in" to using Go Modules you need to turn them using the
GO111MODULE environment variable and setting it to
This is REQUIRED to use Go Modules with "Buffalo" packages. The
auto setting for
GO111MODULE is NOT supported.
$ export GO111MODULE=on
Working Outside of the
In addition to repeatable builds, Go Modules, allows you to easily work outside of the
buffalo command should work as it previously did inside the
$ export GO111MODULE=on $ buffalo new -h
Working Inside the
Because Go Modules are still experimental, and not complete, it is recommended to continue to work INSIDE the
GOPATH. This will allow you to easily move between using, and not using modules.
When working inside the
GOPATH you should continue to use
GOPATH style module names.
This style of module name works both inside, and outside, of the
GOPATH easily. It also makes your projects work with
This style of module, can work inside of the
GOPATH, but it is less flexible, although shorter, than the longer format module name.
Regardless of which module name style you pick, you MUST be consistent within your application.
For example, if your module name is
coke your actions package is
coke/actions. If you module name is
github.com/markbates/coke your actions package is
When I run
buffalo build I get strange errors like this when I run outside of my
invalid import path: "D:/projects/testBuffalo/src/my-project/actions"
Make sure you have
GO111MODULE=on. If you don't, Buffalo, tries to use your
GOPATH to determine your package locations. Enable Go Modules support and try again.
How Do I Migrate From Dep?
go mod init tool can read your
Gopkg.toml files and create a new
go.mod for you. https://github.com/golang/go/wiki/Modules
How Do I Use The
If you want to live on the "edge" and use the latest, bleeding edge, version of Buffalo you can tell Go Modules to get that version:
$ go get -u github.com/gobuffalo/buffalo@development $ go mod tidy