Failed to import the TiDB library module in Golang code

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 在golang代码里import tidb库的模块失败

| username: dba-kit

I want to reuse a parsing module from TiDB in my own project, but I encountered an error during import. The error message is:

github.com/pingcap/tidb/util/table-filter: module github.com/pingcap/tidb@latest found (v1.0.9), but does not contain package github.com/pingcap/tidb/util/table-filter

Additionally, the versioning of the TiDB Golang library is quite confusing, with the latest version still being from 2019. Why isn’t it consistent with the TiDB release versions? Am I using it incorrectly? What is the correct way to reuse the github.com/pingcap/tidb library code? Is there any documentation available?

| username: dba-kit | Original post link

If according to the version number displayed on https://pkg.go.dev/, the error is:

go: downloading github.com/pingcap/tidb/util/table-filter v0.0.0-20231013125129-93a834a6bf8d
go: test/event_handler imports
        github.com/pingcap/tidb/util/table-filter: github.com/pingcap/tidb/util/table-filter@v0.0.0-20231013125129-93a834a6bf8d: reading https://goproxy.io/github.com/pingcap/tidb/util/table-filter/@v/v0.0.0-20231013125129-93a834a6bf8d.zip: 404 Not Found
        server response: not found: github.com/pingcap/tidb/util/table-filter@v0.0.0-20231013125129-93a834a6bf8d: invalid version: missing github.com/pingcap/tidb/util/table-filter/go.mod at revision 93a834a6bf8d
| username: dba-kit | Original post link

I found an alternative package github.com/pingcap/tidb-tools/pkg/table-filter which can be successfully referenced.

| username: 大飞哥online | Original post link

Excellent, truly deserving of the title “Master”.

| username: Fly-bird | Original post link

Awesome :100: :+1:, according to the prompt, it’s the wrong version.

| username: 像风一样的男子 | Original post link

The master is awesome, you could write a column about it.

| username: dba-kit | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.