From 67fdfae380f4acd9e8f26e6a069698c4e86c1f46 Mon Sep 17 00:00:00 2001 From: Jens Rantil Date: Thu, 16 Nov 2017 11:39:10 +0100 Subject: [PATCH 1/5] gitignore vendoring directory --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 93890120..6d1caf93 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ cli/cli cli/migrate .coverage .godoc.pid +/vendor From b8c5221408fdb74398b16c8f0a8ad5ffab834af5 Mon Sep 17 00:00:00 2001 From: Jens Rantil Date: Thu, 16 Nov 2017 11:39:30 +0100 Subject: [PATCH 2/5] lock dependencies By issuing `dep init`. --- Gopkg.lock | 278 +++++++++++++++++++++++++++++++++++++++++++++++++++++ Gopkg.toml | 82 ++++++++++++++++ 2 files changed, 360 insertions(+) create mode 100644 Gopkg.lock create mode 100644 Gopkg.toml diff --git a/Gopkg.lock b/Gopkg.lock new file mode 100644 index 00000000..63e68382 --- /dev/null +++ b/Gopkg.lock @@ -0,0 +1,278 @@ +# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. + + +[[projects]] + name = "cloud.google.com/go" + packages = ["civil","compute/metadata","iam","internal","internal/atomiccache","internal/fields","internal/optional","internal/version","longrunning","longrunning/autogen","spanner","spanner/admin/database/apiv1","storage"] + revision = "2d3a6656c17a60b0815b7e06ab0be04eacb6e613" + version = "v0.16.0" + +[[projects]] + name = "github.com/Microsoft/go-winio" + packages = ["."] + revision = "78439966b38d69bf38227fbf57ac8a6fee70f69a" + version = "v0.4.5" + +[[projects]] + name = "github.com/aws/aws-sdk-go" + packages = ["aws","aws/awserr","aws/awsutil","aws/client","aws/client/metadata","aws/corehandlers","aws/credentials","aws/credentials/ec2rolecreds","aws/credentials/endpointcreds","aws/credentials/stscreds","aws/defaults","aws/ec2metadata","aws/endpoints","aws/request","aws/session","aws/signer/v4","internal/shareddefaults","private/protocol","private/protocol/query","private/protocol/query/queryutil","private/protocol/rest","private/protocol/restxml","private/protocol/xml/xmlutil","service/s3","service/s3/s3iface","service/sts"] + revision = "a532359524fb25c60b6c938ec321b571adc857de" + version = "v1.12.28" + +[[projects]] + branch = "master" + name = "github.com/cockroachdb/cockroach-go" + packages = ["crdb"] + revision = "0d8b4682f140f0fe486ef7e3d2f70665f3066906" + +[[projects]] + branch = "master" + name = "github.com/cznic/b" + packages = ["."] + revision = "c0c71e655879a2848b5a0e0208b63f97325cbacd" + +[[projects]] + branch = "master" + name = "github.com/cznic/fileutil" + packages = ["."] + revision = "2d566d841097e1297dfb576f809cf9eeecbdbc37" + +[[projects]] + name = "github.com/cznic/internal" + packages = ["buffer","file","slice"] + revision = "cef02a853c3a93623c42eacd574e7ea05f55531b" + version = "1.0.0" + +[[projects]] + name = "github.com/cznic/lldb" + packages = ["."] + revision = "bea8611dd5c407f3c5eab9f9c68e887a27dc6f0e" + version = "v1.1.0" + +[[projects]] + branch = "master" + name = "github.com/cznic/mathutil" + packages = ["."] + revision = "09cde8d5df5fd3e1944897ce6d00d83dd5ed3a91" + +[[projects]] + name = "github.com/cznic/ql" + packages = [".","driver","vendored/github.com/camlistore/go4/lock"] + revision = "7a63cd7aa46ecd9f549b96983029576af2178f60" + version = "v1.1.0" + +[[projects]] + branch = "master" + name = "github.com/cznic/sortutil" + packages = ["."] + revision = "4c7342852e65c2088c981288f2c5610d10b9f7f4" + +[[projects]] + branch = "master" + name = "github.com/cznic/strutil" + packages = ["."] + revision = "529a34b1c186b483642a7a230c67521d9aa4b0fb" + +[[projects]] + branch = "master" + name = "github.com/cznic/zappy" + packages = ["."] + revision = "2533cb5b45cc6c07421468ce262899ddc9d53fb7" + +[[projects]] + name = "github.com/docker/distribution" + packages = ["digest","reference"] + revision = "48294d928ced5dd9b378f7fd7c6f5da3ff3f2c89" + version = "v2.6.2" + +[[projects]] + name = "github.com/docker/docker" + packages = ["api/types","api/types/blkiodev","api/types/container","api/types/events","api/types/filters","api/types/mount","api/types/network","api/types/reference","api/types/registry","api/types/strslice","api/types/swarm","api/types/time","api/types/versions","api/types/volume","client","pkg/tlsconfig"] + revision = "092cba3727bb9b4a2f0e922cd6c0f93ea270e363" + version = "v1.13.1" + +[[projects]] + name = "github.com/docker/go-connections" + packages = ["nat","sockets","tlsconfig"] + revision = "3ede32e2033de7505e6500d6c868c2b9ed9f169d" + version = "v0.3.0" + +[[projects]] + name = "github.com/docker/go-units" + packages = ["."] + revision = "0dadbb0345b35ec7ef35e228dabb8de89a65bf52" + version = "v0.3.2" + +[[projects]] + branch = "master" + name = "github.com/edsrzf/mmap-go" + packages = ["."] + revision = "0bce6a6887123b67a60366d2c9fe2dfb74289d2e" + +[[projects]] + branch = "master" + name = "github.com/fsouza/fake-gcs-server" + packages = ["fakestorage"] + revision = "c22980d10f92bb098c4ae653d32ade5c944d35bf" + +[[projects]] + name = "github.com/go-ini/ini" + packages = ["."] + revision = "7e7da451323b6766da368f8a1e8ec9a88a16b4a0" + version = "v1.31.1" + +[[projects]] + name = "github.com/go-sql-driver/mysql" + packages = ["."] + revision = "a0583e0143b1624142adab07e0e97fe106d99561" + version = "v1.3" + +[[projects]] + branch = "master" + name = "github.com/gocql/gocql" + packages = [".","internal/lru","internal/murmur","internal/streams"] + revision = "33a5f3c1bcc2c421b3221c5858312afb141bf605" + +[[projects]] + branch = "master" + name = "github.com/golang/glog" + packages = ["."] + revision = "23def4e6c14b4da8ac2ed8007337bc5eb5007998" + +[[projects]] + branch = "master" + name = "github.com/golang/protobuf" + packages = ["proto","protoc-gen-go/descriptor","ptypes","ptypes/any","ptypes/duration","ptypes/empty","ptypes/struct","ptypes/timestamp"] + revision = "1e59b77b52bf8e4b449a57e6f79f21226d571845" + +[[projects]] + branch = "master" + name = "github.com/golang/snappy" + packages = ["."] + revision = "553a641470496b2327abcac10b36396bd98e45c9" + +[[projects]] + branch = "master" + name = "github.com/google/go-github" + packages = ["github"] + revision = "8b3951c83275136717a7f5e993075b8ba9d09a7e" + +[[projects]] + branch = "master" + name = "github.com/google/go-querystring" + packages = ["query"] + revision = "53e6ce116135b80d037921a7fdd5138cf32d7a8a" + +[[projects]] + name = "github.com/googleapis/gax-go" + packages = ["."] + revision = "317e0006254c44a0ac427cc52a0e083ff0b9622f" + version = "v2.0.0" + +[[projects]] + name = "github.com/gorilla/context" + packages = ["."] + revision = "1ea25387ff6f684839d82767c1733ff4d4d15d0a" + version = "v1.1" + +[[projects]] + name = "github.com/gorilla/mux" + packages = ["."] + revision = "7f08801859139f86dfafd1c296e2cba9a80d292e" + version = "v1.6.0" + +[[projects]] + branch = "master" + name = "github.com/hailocab/go-hostpool" + packages = ["."] + revision = "e80d13ce29ede4452c43dea11e79b9bc8a15b478" + +[[projects]] + name = "github.com/jmespath/go-jmespath" + packages = ["."] + revision = "0b12d6b5" + +[[projects]] + name = "github.com/kshvakov/clickhouse" + packages = [".","lib/binary","lib/column","lib/data","lib/protocol","lib/types","lib/writebuffer"] + revision = "81a24df15f5b96db6bd2558a7894dd7647dcd67d" + version = "v1.3.1" + +[[projects]] + branch = "master" + name = "github.com/lib/pq" + packages = [".","oid"] + revision = "8c6ee72f3e6bcb1542298dd5f76cb74af9742cec" + +[[projects]] + name = "github.com/mattn/go-sqlite3" + packages = ["."] + revision = "ed69081a91fd053f17672236b0dd52ba7485e1a3" + version = "v1.4.0" + +[[projects]] + name = "github.com/pkg/errors" + packages = ["."] + revision = "645ef00459ed84a119197bfb8d8205042c6df63d" + version = "v0.8.0" + +[[projects]] + branch = "master" + name = "golang.org/x/net" + packages = ["context","context/ctxhttp","http2","http2/hpack","idna","internal/timeseries","lex/httplex","proxy","trace"] + revision = "9dfe39835686865bff950a07b394c12a98ddc811" + +[[projects]] + branch = "master" + name = "golang.org/x/oauth2" + packages = [".","google","internal","jws","jwt"] + revision = "9ff8ebcc8e241d46f52ecc5bff0e5a2f2dbef402" + +[[projects]] + branch = "master" + name = "golang.org/x/sys" + packages = ["windows"] + revision = "bf42f188b9bc6f2cf5b8ee5a912ef1aedd0eba4c" + +[[projects]] + branch = "master" + name = "golang.org/x/text" + packages = ["collate","collate/build","internal/colltab","internal/gen","internal/tag","internal/triegen","internal/ucd","language","secure/bidirule","transform","unicode/bidi","unicode/cldr","unicode/norm","unicode/rangetable"] + revision = "88f656faf3f37f690df1a32515b479415e1a6769" + +[[projects]] + branch = "master" + name = "google.golang.org/api" + packages = ["gensupport","googleapi","googleapi/internal/uritemplates","googleapi/transport","internal","iterator","option","storage/v1","transport","transport/grpc","transport/http"] + revision = "a0c31fb0028e0111b942a29b9fc2e9235202c48b" + +[[projects]] + name = "google.golang.org/appengine" + packages = [".","internal","internal/app_identity","internal/base","internal/datastore","internal/log","internal/modules","internal/remote_api","internal/socket","internal/urlfetch","socket","urlfetch"] + revision = "150dc57a1b433e64154302bdc40b6bb8aefa313a" + version = "v1.0.0" + +[[projects]] + branch = "master" + name = "google.golang.org/genproto" + packages = ["googleapis/api/annotations","googleapis/iam/v1","googleapis/longrunning","googleapis/rpc/errdetails","googleapis/rpc/status","googleapis/spanner/admin/database/v1","googleapis/spanner/v1"] + revision = "11c7f9e547da6db876260ce49ea7536985904c9b" + +[[projects]] + name = "google.golang.org/grpc" + packages = [".","balancer","codes","connectivity","credentials","credentials/oauth","grpclb/grpc_lb_v1/messages","grpclog","internal","keepalive","metadata","naming","peer","resolver","stats","status","tap","transport"] + revision = "401e0e00e4bb830a10496d64cd95e068c5bf50de" + version = "v1.7.3" + +[[projects]] + name = "gopkg.in/inf.v0" + packages = ["."] + revision = "3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4" + version = "v0.9.0" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-digest = "d867c76112240142e088f09ef5d3ee4607174cbd782bae1ff0abdb95ba120267" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml new file mode 100644 index 00000000..65310420 --- /dev/null +++ b/Gopkg.toml @@ -0,0 +1,82 @@ + +# Gopkg.toml example +# +# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md +# for detailed Gopkg.toml documentation. +# +# required = ["github.com/user/thing/cmd/thing"] +# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] +# +# [[constraint]] +# name = "github.com/user/project" +# version = "1.0.0" +# +# [[constraint]] +# name = "github.com/user/project2" +# branch = "dev" +# source = "github.com/myfork/project2" +# +# [[override]] +# name = "github.com/x/y" +# version = "2.4.0" + + +[[constraint]] + name = "cloud.google.com/go" + version = "0.16.0" + +[[constraint]] + name = "github.com/aws/aws-sdk-go" + version = "1.12.28" + +[[constraint]] + branch = "master" + name = "github.com/cockroachdb/cockroach-go" + +[[constraint]] + name = "github.com/cznic/ql" + version = "1.1.0" + +[[constraint]] + name = "github.com/docker/docker" + version = "1.13.1" + +[[constraint]] + branch = "master" + name = "github.com/fsouza/fake-gcs-server" + +[[constraint]] + name = "github.com/go-sql-driver/mysql" + version = "1.3.0" + +[[constraint]] + branch = "master" + name = "github.com/gocql/gocql" + +[[constraint]] + branch = "master" + name = "github.com/google/go-github" + +[[constraint]] + name = "github.com/kshvakov/clickhouse" + version = "1.3.1" + +[[constraint]] + branch = "master" + name = "github.com/lib/pq" + +[[constraint]] + name = "github.com/mattn/go-sqlite3" + version = "1.4.0" + +[[constraint]] + branch = "master" + name = "golang.org/x/net" + +[[constraint]] + branch = "master" + name = "google.golang.org/api" + +[[constraint]] + branch = "master" + name = "google.golang.org/genproto" From 4512ddff4a4d4d9445ec632aee92b4fdfc237f7a Mon Sep 17 00:00:00 2001 From: Jens Rantil Date: Thu, 16 Nov 2017 14:07:18 +0100 Subject: [PATCH 3/5] vendoring: no need to list external deps ...the information can now be found in the `dep` files. --- Makefile | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/Makefile b/Makefile index e36394be..6f9e6bf7 100644 --- a/Makefile +++ b/Makefile @@ -63,20 +63,6 @@ deps: -go get -u github.com/fsouza/fake-gcs-server/fakestorage -list-external-deps: - $(call external_deps,'.') - $(call external_deps,'./cli/...') - $(call external_deps,'./testing/...') - - $(foreach v, $(SOURCE), $(call external_deps,'./source/$(v)/...')) - $(call external_deps,'./source/testing/...') - $(call external_deps,'./source/stub/...') - - $(foreach v, $(DATABASE), $(call external_deps,'./database/$(v)/...')) - $(call external_deps,'./database/testing/...') - $(call external_deps,'./database/stub/...') - - restore-import-paths: find . -name '*.go' -type f -execdir sed -i '' s%\"github.com/$(REPO_OWNER)/migrate%\"github.com/mattes/migrate%g '{}' \; @@ -108,12 +94,6 @@ release: @read -p "Press enter to confirm and push to origin ..." && git push origin v$(V) -define external_deps - @echo '-- $(1)'; go list -f '{{join .Deps "\n"}}' $(1) | grep -v github.com/$(REPO_OWNER)/migrate | xargs go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}' - -endef - - .PHONY: build-cli clean test-short test test-with-flags deps html-coverage \ restore-import-paths rewrite-import-paths list-external-deps release \ docs kill-docs open-docs kill-orphaned-docker-containers From 80ee8e2a82bdb7120278f898e72bf3690b3268ac Mon Sep 17 00:00:00 2001 From: Jens Rantil Date: Thu, 16 Nov 2017 14:09:06 +0100 Subject: [PATCH 4/5] ref: always build all sources and databases Simplifies stuff a lot and much less needed now that that vendoring is in place. --- Makefile | 23 ++++------------------- cli/build_aws-s3.go | 2 -- cli/build_cassandra.go | 2 -- cli/build_clickhouse.go | 2 -- cli/build_cockroachdb.go | 2 -- cli/build_github.go | 2 -- cli/build_go-bindata.go | 2 -- cli/build_google-cloud-storage.go | 2 -- cli/build_mysql.go | 2 -- cli/build_postgres.go | 2 -- cli/build_ql.go | 2 -- cli/build_redshift.go | 2 -- cli/build_spanner.go | 2 -- cli/build_sqlite3.go | 2 -- 14 files changed, 4 insertions(+), 45 deletions(-) diff --git a/Makefile b/Makefile index 6f9e6bf7..27240638 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,3 @@ -SOURCE ?= file go-bindata github aws-s3 google-cloud-storage -DATABASE ?= postgres mysql redshift cassandra sqlite3 spanner cockroachdb clickhouse VERSION ?= $(shell git describe --tags 2>/dev/null | cut -c 2-) TEST_FLAGS ?= REPO_OWNER ?= $(shell cd .. && basename "$$(pwd)") @@ -7,9 +5,9 @@ REPO_OWNER ?= $(shell cd .. && basename "$$(pwd)") build-cli: clean -mkdir ./cli/build - cd ./cli && CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -a -o build/migrate.linux-amd64 -ldflags='-X main.Version=$(VERSION)' -tags '$(DATABASE) $(SOURCE)' . - cd ./cli && CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -a -o build/migrate.darwin-amd64 -ldflags='-X main.Version=$(VERSION)' -tags '$(DATABASE) $(SOURCE)' . - cd ./cli && CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -a -o build/migrate.windows-amd64.exe -ldflags='-X main.Version=$(VERSION)' -tags '$(DATABASE) $(SOURCE)' . + cd ./cli && CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -a -o build/migrate.linux-amd64 -ldflags='-X main.Version=$(VERSION)' . + cd ./cli && CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -a -o build/migrate.darwin-amd64 -ldflags='-X main.Version=$(VERSION)' . + cd ./cli && CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -a -o build/migrate.windows-amd64.exe -ldflags='-X main.Version=$(VERSION)' . cd ./cli/build && find . -name 'migrate*' | xargs -I{} tar czf {}.tar.gz {} cd ./cli/build && shasum -a 256 * > sha256sum.txt cat ./cli/build/sha256sum.txt @@ -32,20 +30,7 @@ test: test-with-flags: - @echo SOURCE: $(SOURCE) - @echo DATABASE: $(DATABASE) - - @go test $(TEST_FLAGS) . - @go test $(TEST_FLAGS) ./cli/... - @go test $(TEST_FLAGS) ./testing/... - - @echo -n '$(SOURCE)' | tr -s ' ' '\n' | xargs -I{} go test $(TEST_FLAGS) ./source/{} - @go test $(TEST_FLAGS) ./source/testing/... - @go test $(TEST_FLAGS) ./source/stub/... - - @echo -n '$(DATABASE)' | tr -s ' ' '\n' | xargs -I{} go test $(TEST_FLAGS) ./database/{} - @go test $(TEST_FLAGS) ./database/testing/... - @go test $(TEST_FLAGS) ./database/stub/... + @go test $(TEST_FLAGS) ./... kill-orphaned-docker-containers: diff --git a/cli/build_aws-s3.go b/cli/build_aws-s3.go index 766fd566..f782eaa3 100644 --- a/cli/build_aws-s3.go +++ b/cli/build_aws-s3.go @@ -1,5 +1,3 @@ -// +build aws-s3 - package main import ( diff --git a/cli/build_cassandra.go b/cli/build_cassandra.go index 319b52d2..d3a6e400 100644 --- a/cli/build_cassandra.go +++ b/cli/build_cassandra.go @@ -1,5 +1,3 @@ -// +build cassandra - package main import ( diff --git a/cli/build_clickhouse.go b/cli/build_clickhouse.go index c9175e28..ee7d50b6 100644 --- a/cli/build_clickhouse.go +++ b/cli/build_clickhouse.go @@ -1,5 +1,3 @@ -// +build clickhouse - package main import ( diff --git a/cli/build_cockroachdb.go b/cli/build_cockroachdb.go index e5fdf073..95b0cd9e 100644 --- a/cli/build_cockroachdb.go +++ b/cli/build_cockroachdb.go @@ -1,5 +1,3 @@ -// +build cockroachdb - package main import ( diff --git a/cli/build_github.go b/cli/build_github.go index 9c813b46..403dfd52 100644 --- a/cli/build_github.go +++ b/cli/build_github.go @@ -1,5 +1,3 @@ -// +build github - package main import ( diff --git a/cli/build_go-bindata.go b/cli/build_go-bindata.go index 8a6a8934..94fdcb78 100644 --- a/cli/build_go-bindata.go +++ b/cli/build_go-bindata.go @@ -1,5 +1,3 @@ -// +build go-bindata - package main import ( diff --git a/cli/build_google-cloud-storage.go b/cli/build_google-cloud-storage.go index 04f31433..09f7033f 100644 --- a/cli/build_google-cloud-storage.go +++ b/cli/build_google-cloud-storage.go @@ -1,5 +1,3 @@ -// +build google-cloud-storage - package main import ( diff --git a/cli/build_mysql.go b/cli/build_mysql.go index 177766f5..d07d9549 100644 --- a/cli/build_mysql.go +++ b/cli/build_mysql.go @@ -1,5 +1,3 @@ -// +build mysql - package main import ( diff --git a/cli/build_postgres.go b/cli/build_postgres.go index 87f6be75..d9ed4402 100644 --- a/cli/build_postgres.go +++ b/cli/build_postgres.go @@ -1,5 +1,3 @@ -// +build postgres - package main import ( diff --git a/cli/build_ql.go b/cli/build_ql.go index cd56ef95..6233eba5 100644 --- a/cli/build_ql.go +++ b/cli/build_ql.go @@ -1,5 +1,3 @@ -// +build ql - package main import ( diff --git a/cli/build_redshift.go b/cli/build_redshift.go index 8153d0aa..7ea1121f 100644 --- a/cli/build_redshift.go +++ b/cli/build_redshift.go @@ -1,5 +1,3 @@ -// +build redshift - package main import ( diff --git a/cli/build_spanner.go b/cli/build_spanner.go index 7223d820..615a1bca 100644 --- a/cli/build_spanner.go +++ b/cli/build_spanner.go @@ -1,5 +1,3 @@ -// +build spanner - package main import ( diff --git a/cli/build_sqlite3.go b/cli/build_sqlite3.go index 48ae8ebc..f2865f2d 100644 --- a/cli/build_sqlite3.go +++ b/cli/build_sqlite3.go @@ -1,5 +1,3 @@ -// +build sqlite3 - package main import ( From 35fee8299d1cc7b4a40cc7c242c5d8c024e88464 Mon Sep 17 00:00:00 2001 From: Jens Rantil Date: Thu, 16 Nov 2017 14:43:27 +0100 Subject: [PATCH 5/5] Makefile: `dep ensure` before building --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 27240638..6aed23ca 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ REPO_OWNER ?= $(shell cd .. && basename "$$(pwd)") build-cli: clean + dep ensure -mkdir ./cli/build cd ./cli && CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -a -o build/migrate.linux-amd64 -ldflags='-X main.Version=$(VERSION)' . cd ./cli && CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -a -o build/migrate.darwin-amd64 -ldflags='-X main.Version=$(VERSION)' .