Skip to content

How do you get started? #812

Description

@xeoncross

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?

Activity

  1. tangenta commented on Jun 29, 2020

    @tangenta
    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.

  2. qiukeren commented on Jul 22, 2020

    @qiukeren
    [~]: 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...

  3. tangenta commented on Jul 22, 2020

    @tangenta
    Contributor

    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 :(

  4. zhangysh1995 commented on Sep 2, 2020

    @zhangysh1995

    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.

  5. zhangysh1995 commented on Sep 2, 2020

    @zhangysh1995

    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.

  6. clarkmcc commented on Jul 28, 2021

    @clarkmcc

    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:"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/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:"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/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:"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/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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions