From f1d88ac6c185ef9cdb068cf7cb96905161d6ecf4 Mon Sep 17 00:00:00 2001 From: Dale Hui Date: Wed, 28 Nov 2018 01:00:46 -0800 Subject: [PATCH] Add guide for installing a specific version of `migrate` using the Go toolchain --- cli/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cli/README.md b/cli/README.md index 600df0dd3..472cc4187 100644 --- a/cli/README.md +++ b/cli/README.md @@ -27,10 +27,20 @@ $ apt-get install -y migrate #### With Go toolchain +##### Unversioned ``` $ go get -tags 'postgres' -u github.com/golang-migrate/migrate/cmd/migrate ``` +##### Versioned + +``` +$ go get -u -d github.com/golang-migrate/migrate/cmd/migrate +$ cd $GOPATH/src/github.com/golang-migrate/migrate/cmd/migrate +$ git checkout $TAG # e.g. v4.1.0 +$ go build -tags 'postgres' -ldflags="-X main.Version=$(git describe --tags)" -o $GOPATH/bin/migrate github.com/golang-migrate/migrate/cmd/migrate +``` + ##### Notes: 1. Requires a version of Go that [supports modules](https://golang.org/cmd/go/#hdr-Preliminary_module_support). e.g. Go 1.11+ 1. This example builds the cli which will only work with postgres. In order