Closed mauleyzaola closed 5 years ago
I cannot seem to import this library anymore, it seems to be some dependency to https://github.com/mattn/go-sqlite3 which has a recently closed issue here but I don't think it's fixed properly
If i try to go get -u github.com/rubenv/sql-migrate
I see the following error
build github.com/rubenv/sql-migrate/sql-migrate: cannot load github.com/mattn/go-sqlite3: module github.com/mattn/go-sqlite3@latest found (v2.0.0+incompatible), but does not contain package github.com/mattn/go-sqlite3
Looks like github.com/posener/complete
latest has been updated with a breaking version change - how does sql-migrate manage its own dependencies?
TL/DR:
GO111MODULE=on GOPRIVATE=github.com/mattn/go-sqlite3 go get github.com/rubenv/sql-migrate/...
details:
sql-migrate
depends on github.com/mitchellh/cli
, which in turn depends on github.com/posener/complete
This error happens because you try to go get github.com/rubenv/sql-migrate/...
in no-module aware mode, but:
posener/complete
was upgraded to v2
while
mitchellh/cli
still relies on posener/complete
v1
Since in your case go get
does not know about modules, it will try to download latest posener/complete
v2 from master branch, which does not work with mitchellh/cli
.
You can fix this by installing sql-migrate in module-aware mode.
But, then you will bump into another unrelated error described here https://github.com/mattn/go-sqlite3/issues/755. To temporary work around it you should disable proxy cache for go-sqlite3:
GO111MODULE=on GOPRIVATE=github.com/mattn/go-sqlite3 go get github.com/rubenv/sql-migrate/...
This sounds like a bug in mattn/go-sqlite3
rather than sql-migrate
?
I don't want to require module support (even though it's great), so there's nothing we can do here.
It is more like go mod
nuances.
The trouble here is that github.com/posener/complete
decided to release v2 directly into master instead of keeping it in a separate /v2/ subdirectory or branch. Contrary to the recommendation here:
https://blog.golang.org/v2-go-modules (see Major version strategies section)
~We run Go 1.13 - does that mean we should not use GO111MODULE=on in the workaround?~
To answer my own question, yes GO111MODULE=on is necessary
Hi, I am sorry for causing this bug.
It looks like this project depends on github.com/mitchellh/cli which depends on github.com/posener/complete.
I don't like the v2 directory solution as versioning solution in Go. The v1 is still available through git branch or git tags, also proposed by the strategies in the Go blog.
About solutions: I can revert the change and push the change to a v2 directory in my project. However, I would prefer if we could add go modules support to this project? I can try to help if this is needed.
Hi, I am sorry for causing this bug.
No worries, that happens!
@posener If adding /v2/ subdir feels ugly, maybe you can create a new v2 branch (and make it github default)? Who knows what other tools depending on github.com/mitchellh/cli can break.
@drscre good idea! I've made this PR https://github.com/mitchellh/cli/pull/80 to fix the cli package. When trying to have go modules in this library there is the error of this issue: https://github.com/mattn/go-sqlite3/issues/755. I think adding go modules support in go-sqlite3 will fix it? If mitchellh won't merge the PR in the next few days, I'll update my library as you say.
I'm having troubles there, since the CLI library should also be compatible with older Go versions. I took you advice, set the master to point on v1 and set v2 to be the default branch. See if that works for you. Thanks
This needs more work, just tested it on a fresh linux box and still not building.
As a temporary workaround I forked this repo, grabbed the dependencies via dep ensure
and push them all to my forked repo.
That compiles well but has the obvious disadvantages.
Just in case someone else is struggling with this issue.
Same error?
On Tue, Nov 19, 2019, 15:11 Mauricio Leyzaola notifications@github.com wrote:
This needs more work, just tested it on a fresh linux box and still not building. I know you like to keep things simple. As a temporary workaround I forked this repo, grabbed the dependencies via dep ensure and push them all to my forked repo. That compiles well but has the obvious advantages. Just in case someone else is struggling with this issue.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rubenv/sql-migrate/issues/155?email_source=notifications&email_token=AAHAN7UJNCCENXNOBCWDQP3QUPQWVA5CNFSM4JON4BSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEOEJEA#issuecomment-555500688, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHAN7RRNJIRLYEJHSZBS6TQUPQWVANCNFSM4JON4BSA .
@posener Yeah
ubuntu@server:~$ go get -v github.com/rubenv/sql-migrate/...
github.com/rubenv/sql-migrate (download)
created GOPATH=/home/ubuntu/go; see 'go help gopath'
get "gopkg.in/gorp.v1": found meta tag get.metaImport{Prefix:"gopkg.in/gorp.v1", VCS:"git", RepoRoot:"https://gopkg.in/gorp.v1"} at //gopkg.in/gorp.v1?go-get=1
gopkg.in/gorp.v1 (download)
github.com/denisenkom/go-mssqldb (download)
github.com/golang-sql/civil (download)
get "golang.org/x/crypto/md4": found meta tag get.metaImport{Prefix:"golang.org/x/crypto", VCS:"git", RepoRoot:"https://go.googlesource.com/crypto"} at //golang.org/x/crypto/md4?go-get=1
get "golang.org/x/crypto/md4": verifying non-authoritative meta tag
golang.org/x/crypto (download)
github.com/go-sql-driver/mysql (download)
github.com/lib/pq (download)
github.com/mattn/go-sqlite3 (download)
github.com/mitchellh/cli (download)
github.com/armon/go-radix (download)
github.com/bgentry/speakeasy (download)
github.com/fatih/color (download)
github.com/mattn/go-isatty (download)
get "golang.org/x/sys/unix": found meta tag get.metaImport{Prefix:"golang.org/x/sys", VCS:"git", RepoRoot:"https://go.googlesource.com/sys"} at //golang.org/x/sys/unix?go-get=1
get "golang.org/x/sys/unix": verifying non-authoritative meta tag
golang.org/x/sys (download)
github.com/posener/complete (download)
github.com/hashicorp/go-multierror (download)
github.com/hashicorp/errwrap (download)
package github.com/rubenv/sql-migrate/sql-migrate
imports github.com/posener/complete/cmd/install: cannot find package "github.com/posener/complete/cmd/install" in any of:
/usr/local/go/src/github.com/posener/complete/cmd/install (from $GOROOT)
/home/ubuntu/go/src/github.com/posener/complete/cmd/install (from $GOPATH)
github.com/olekukonko/tablewriter (download)
github.com/mattn/go-runewidth (download)
get "gopkg.in/yaml.v2": found meta tag get.metaImport{Prefix:"gopkg.in/yaml.v2", VCS:"git", RepoRoot:"https://gopkg.in/yaml.v2"} at //gopkg.in/yaml.v2?go-get=1
gopkg.in/yaml.v2 (download)
ubuntu@server:~$ which sql-migrate
ubuntu@server:~$ go version
go version go1.13.4 linux/amd64
FYI we are also seeing the indirect dependency through github.com/mitchellh/cli
on github.com/posener/complete
break the build for Spinnaker's CLI tool. Thank you for opening https://github.com/mitchellh/cli/pull/80
@posener it turns out that go get
uses default branch, not master :/. You should change default branch back to master in GitHub repo settings. Sorry for misleading you.
I updated the default branch. Looking for a solution if anyone has one.
On Wed, Nov 20, 2019, 10:09 Ivan Skriabin notifications@github.com wrote:
@posener https://github.com/posener it turns out that go get uses default branch, not master :/. You should change default branch to master. Sorry for misleading you
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rubenv/sql-migrate/issues/155?email_source=notifications&email_token=AAHAN7V2UHPI6H4QK3KRRPLQUTWFHA5CNFSM4JON4BSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEERDBQQ#issuecomment-555888834, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHAN7WXABHU755VTZV4FWTQUTWFHANCNFSM4JON4BSA .
I think you can close this issue. If you are interesting on insights from this journey, I've written a blog post on it :-) https://posener.github.io/branch-strategy/
Thanks for the help!
This is a machine which has no golang code on it, like a fresh install
OUTPUT
ENVIRONMENT