Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do you get started? #812

Open
xeoncross opened this issue Apr 18, 2020 · 6 comments
Open

How do you get started? #812

xeoncross opened this issue Apr 18, 2020 · 6 comments

Comments

@xeoncross
Copy link

The quick start doesn't seem to work because of the dependency on TiDB.

I start by including both packages:

go get github.com/pingcap/parser
go get github.com/pingcap/tidb

This leaves me with a go.mod which looks like this:

...
github.com/pingcap/parser v3.0.12+incompatible
github.com/pingcap/tidb v2.0.11+incompatible // indirect
github.com/pingcap/tipb v0.0.0-20200417094153-7316d94df1ee // indirect 
...

The main issue seems to be that in the version of tidb used, the tidb/types package does not contain parser_driver.

Screen Shot 2020-04-17 at 6 46 41 PM

It looks like it exists in the recent v3.1.0 release.

I tried to force that version but it doesn't seem to be working.

$ go get github.com/pingcap/tidb@v3.1.0
go get github.com/pingcap/tidb@v3.1.0: github.com/pingcap/tidb@v3.1.0: invalid version: module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v3

How do I get the parser working?

@tangenta
Copy link
Contributor

v3.1.0 release is not the latest version and it lacks the package parser_driver.

go get -v github.com/pingcap/parser@v4.0.0-rc.1

should fix the problem.

See https://github.com/pingcap/parser/blob/master/docs/quickstart.md#import-dependencies.

@qiukeren
Copy link

[~]: cd src/
[~/src]: mkdir colx && cd colx
[~/src/colx]: go mod init colx && touch main.go
go: creating new go.mod: module colx
[~/src/colx]: go get -v github.com/pingcap/parser@v4.0.0-rc.1
go get github.com/pingcap/parser@v4.0.0-rc.1: github.com/pingcap/parser@v4.0.0-rc.1: invalid version: module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v4

does not fix...

@tangenta
Copy link
Contributor

tangenta commented Jul 22, 2020

Okay.

As a workaround, you can specify the githash on v4.0.0-rc.1:

go get -v github.com/pingcap/parser@7329d80

Let's figure out how to solve this annoying problem :(

This was referenced Jul 28, 2020
@zhangysh1995
Copy link

I got the same error here by following the quickstart,

C:\Users\zhangysh1995\go\src\eqsql>go get github.com/pingcap/tidb/types/parser_driver@v4.0.0-rc.1
go get github.com/pingcap/tidb/types/parser_driver@v4.0.0-rc.1: github.com/pingcap/tidb@v4.0.0-rc.1: invalid ver
sion: module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v4

The workaround also solved my problem.

@zhangysh1995
Copy link

The workaround also solved my problem.

The quickstart guide is conflicting to itself, we should use go get -v github.com/pingcap/tidb/types/parser_driver@328b6d0 in the Import Dependencies section, but not following the NOTE in Parse SQL text.

@clarkmcc
Copy link

clarkmcc commented Jul 28, 2021

I can't get this to work after following the quick start guide or the suggestions here.

go get -v github.com/pingcap/parser@7329d80
get "golang.org/x/text": found meta tag vcs.metaImport{Prefix:"golang.org/x/text", VCS:"git", RepoRoot:"https://go.googlesource.com/text"} at //golang.org/x/text?go-get=1
get "go.uber.org/multierr": found meta tag vcs.metaImport{Prefix:"go.uber.org/multierr", VCS:"git", RepoRoot:"https://github.com/uber-go/multierr"} at //go.uber.org/multierr?go-get=1
get "go.uber.org/atomic": found meta tag vcs.metaImport{Prefix:"go.uber.org/atomic", VCS:"git", RepoRoot:"https://github.com/uber-go/atomic"} at //go.uber.org/atomic?go-get=1
get "go.uber.org/zap": found meta tag vcs.metaImport{Prefix:"go.uber.org/zap", VCS:"git", RepoRoot:"https://github.com/uber-go/zap"} at //go.uber.org/zap?go-get=1
get "gopkg.in/natefinch/lumberjack.v2": found meta tag vcs.metaImport{Prefix:"gopkg.in/natefinch/lumberjack.v2", VCS:"git", RepoRoot:"https://gopkg.in/natefinch/lumberjack.v2"} at //gopkg.in/natefinch/lumberjack.v2?go-get=1

go get -v github.com/pingcap/tidb/types/parser_driver@328b6d0
go get: github.com/pingcap/tidb@v1.1.0-beta updating to
        github.com/pingcap/tidb@v1.1.0-beta.0.20200630082100-328b6d0a955c requires
        github.com/pingcap/br@v0.0.0-20200623060633-439a1c2b2bfd requires
        github.com/pingcap/tidb@v1.1.0-beta.0.20200606093724-b5b4da0e6a90 requires
        github.com/pingcap/br@v0.0.0-20200521085655-53201addd4ad requires
        github.com/pingcap/tidb@v1.1.0-beta.0.20200509133407-a9dc72cf2558 requires
        github.com/pingcap/pd/v4@v4.0.0-rc.1.0.20200422143320-428acd53eba2: invalid pseudo-version: revision 428acd53eba2 is not a descendent of preceding tag (v4.0.0-rc.1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants