From d787e50e92c45a7169e753c8977a0643c6037fbb Mon Sep 17 00:00:00 2001 From: codestation Date: Fri, 15 Nov 2019 17:14:19 -0500 Subject: [PATCH] Use packr v2 on examples and tests --- README.md | 10 ++++++++-- migrate_test.go | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0a283938..36488556 100644 --- a/README.md +++ b/README.md @@ -159,7 +159,7 @@ migrations := &migrate.FileMigrationSource{ // OR: Use migrations from a packr box migrations := &migrate.PackrMigrationSource{ - Box: packr.NewBox("./migrations"), + Box: packr.New("migrations", "./migrations"), } // OR: Use migrations from bindata: @@ -250,11 +250,17 @@ If you like your Go applications self-contained (that is: a single binary): use Just write your migration files as usual, as a set of SQL files in a folder. +Import the packr package into your application: + +```go +import "github.com/gobuffalo/packr/v2" +``` + Use the `PackrMigrationSource` in your application to find the migrations: ```go migrations := &migrate.PackrMigrationSource{ - Box: packr.NewBox("./migrations"), + Box: packr.New("migrations", "./migrations"), } ``` diff --git a/migrate_test.go b/migrate_test.go index 93db4cc4..80928308 100644 --- a/migrate_test.go +++ b/migrate_test.go @@ -4,7 +4,7 @@ import ( "database/sql" "net/http" - "github.com/gobuffalo/packr" + "github.com/gobuffalo/packr/v2" _ "github.com/mattn/go-sqlite3" . "gopkg.in/check.v1" "gopkg.in/gorp.v1" @@ -162,7 +162,7 @@ func (s *SqliteMigrateSuite) TestAssetMigrate(c *C) { func (s *SqliteMigrateSuite) TestPackrMigrate(c *C) { migrations := &PackrMigrationSource{ - Box: packr.NewBox("test-migrations"), + Box: packr.New("migrations", "test-migrations"), } // Executes two migrations