From 6cb3146b096eb13929a019788f71d518d3c2b0c3 Mon Sep 17 00:00:00 2001 From: Eric Chiang Date: Mon, 21 Dec 2015 09:43:45 -0800 Subject: [PATCH] build,db: don't call go-bindata on every build Add go generate rule to generate migration assets. --- build | 16 ---------------- db/migrations/migrations.go | 6 ++++++ 2 files changed, 6 insertions(+), 16 deletions(-) create mode 100644 db/migrations/migrations.go diff --git a/build b/build index 0493c3e1..564232fa 100755 --- a/build +++ b/build @@ -3,22 +3,6 @@ export GOPATH=${PWD}/Godeps/_workspace export GOBIN=${PWD}/bin -if command -v go-bindata &>/dev/null; then - DEX_MIGRATE_FROM_DISK=${DEX_MIGRATE_FROM_DISK:=false} - - echo "Turning migrations into ./db/migrations/assets.go" - if [ "$DEX_MIGRATE_FROM_DISK" = true ]; then - echo "Compiling migrations.go: will read migrations from disk." - else - echo "Compiling migrations into migrations.go" - fi - go-bindata -debug=$DEX_MIGRATE_FROM_DISK -modtime=1 -pkg migrations -o ./db/migrations/assets.go ./db/migrations - gofmt -w ./db/migrations/assets.go -else - echo "Could not find go-bindata in path, will not generate migrations" - echo "Install go-bindata with: go get -u github.com/jteeuwen/go-bindata/..." -fi - rm -rf $GOPATH/src/github.com/coreos/dex mkdir -p $GOPATH/src/github.com/coreos/ diff --git a/db/migrations/migrations.go b/db/migrations/migrations.go new file mode 100644 index 00000000..b9a50e71 --- /dev/null +++ b/db/migrations/migrations.go @@ -0,0 +1,6 @@ +package migrations + +// To download go-bindata run `go get -u github.com/jteeuwen/go-bindata/...` + +//go:generate go-bindata -modtime=1 -pkg migrations -o assets.go ../ +//go:generate gofmt -w assets.go