-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Cannot get latest version: module contains a go.mod file, so module path should be github.com/pingcap/tidb/v3 #16381
Comments
seems this issue is duplicated with #12135. @tiancaiamao PTAL |
Some of our team member do not agree with this change. |
Does adding |
To my knowledge, we do use |
It does not make sense, especially for a community project.
What is other's justification of not obeying the standard rules? |
ImpactUsing Anyone using Go modules (and maybe some of the other package managers) will not be able to easily use any newer version of tidb ReasonGo modules is implemented incorrectly. In the description for modules, it heavily emphasizes that different major versions must have different import paths. That means not only updating the module description to import (
"github.com/pingcap/tidb/v3/meta"
"github.com/pingcap/tidb/v3/util"
"github.com/pingcap/tidb/v3/util/expensivequery"
) OptionsKill the go.mod files.This would push them back to not being managed by Go modules (instead of incorrectly using Go modules). Importing specific versions would work, but they'd receive the Probably best option short-term -- better to not use Go modules than use it incorrectly. Also, best option for older branches/versions that aren't maintained. Make breaking changesGo ahead and change all the import paths as well. This would probably only be acceptable on the v4 line, since it'd break any consumers. Major version bump / repository changeLeave
|
PTAL @siddontang |
This is a trade-off of the release management and project development, I think the standard rule of go modules conflicts with our development mode, there will be some extra works when we want to cherry-pick a bugfix to I apologize for the inconvenience. I think this is mainly a design flaw of Golang modules. |
This sounds a reasonable option to me. It is fine for user to receive |
Go is a rather opinionated language - as is the modules portion. The modules documentation states using proper semver and having different import paths is a requirement to use Go modules. Additionally, they document the semver requirement was done so they could avoid the diamond dependency problem (explained at length https://research.swtch.com/vgo-import) and to allow gradually upgrading code (have different major versions at the same time).
Cherry-picks would still work if they don't change the import section (for internal packages). Arguably if the imports change, it's more likely for there to be differences between major versions where simply cherry-picking wouldn't be appropriate.
You'd have to make sure that it references the specific commit and not the actual version number. Otherwise, it'll break other commands like It does look like you can currently use these commands for a workaround: # go get github.com/pingcap/tidb@<branch>
go get github.com/pingcap/[email protected]
# go get github.com/pingcap/tidb@<commit hash>
go get github.com/pingcap/tidb@fcbcc4569fbd7aba9eb92092149f092346b934ec Of course, using the branch name doesn't guarantee you get a working release. Also, the 'version' it shows in the
Regardless, since it's against one of the design choices of Go, it'll be a bit of a hack. Instead of
I suppose if you want to keep using Go modules in developing, rather than straight-up delete the |
As my observation there is several voice talking about go submodule or be able to get tidb by Reference |
This is an attempt to make tidb repo work with gomodules. See: https://chat.google.com/room/AAAAgmRUTSU/eTOOzLPbJgI pingcap#16381
This is an attempt to make tidb repo work with gomodules. See: https://chat.google.com/room/AAAAgmRUTSU/eTOOzLPbJgI pingcap#16381
This is an attempt to make tidb repo work with gomodules. See: https://chat.google.com/room/AAAAgmRUTSU/eTOOzLPbJgI pingcap#16381
Background
The
github.com/pingcap/tidb
uses Go modules and the current release version isv3
. And it’s module path is"github.com/pingcap/tidb"
, instead of"github.com/pingcap/tidb/v3"
. It must comply with the specification of "Releasing Modules for v2 or higher" available in the Modules documentation. Quoting the specification:Steps to Reproduce
GO111MODULE=on, run
go get
targeting any version >= v2.1.0 of thepingcap/tidb
:run
go get github.com/pingcap/tidb
, the version will stuck in v2.0.11:SO anyone using Go modules will not be able to easily use any newer version of
pingcap/tidb
.Solution
1. Kill the go.mod files, rolling back to GOPATH.
This would push them back to not being managed by Go modules (instead of incorrectly using Go modules).
Ensure compatibility for downstream module-aware projects and module-unaware projects projects
I see these dependencies in your go.mod file, which need modle awareness. So you'd better not use third-party tools(such as: Dep, glide, govendor…).
You also need to update the import path to:
2. Fix module path to strictly follow SIV rules.
Patch the
go.mod
file to declare the module path asgithub.com/pingcap/tidb/v3
as per the specs. And adjust all internal imports.The downstream projects might be negatively affected in their building if they are module-unaware (Go versions older than 1.9.7 and 1.10.3; Or use third-party dependency management tools, such as: Dep, glide,govendor…).
[*] You can see who will be affected here: [85 module-unaware users, i.e., GayStudio/openbilibili, GDWGH/mu-li-xian-bei, smallnest/soar]
https://github.com/search?o=desc&q=%22github.com%2Fpingcap%2Ftidb%22+filename%3AGodeps.json+filename%3Avendor.conf+filename%3Avendor.json+filename%3Aglide.toml+filename%3AGodep.toml&s=indexed&type=Code
If you don't want to break the above repos. This method can provides better backwards-compatibility.
Release a v2 or higher module through the major subdirectory strategy: Create a new v3
subdirectory
(github.com/pingcap/tidb/v3) and place a new go.mod file in that subdirectory. Themodule path
must end with/v3
. Copy or move the code into the v3 subdirectory. Updateimport statements
within the module to also use/v3
(import "github.com/pingcap/tidb/v3/…"). Tag the release withv3.x.y
.3. Suggest your downstream module users use hash instead of a version tag.
If the standard rule of go modules conflicts with your development mode. Or not intended to be used as a library and does not make any guarantees about the API. So you can’t comply with the specification of "Releasing Modules for v2 or higher" available in the Modules documentation.
Regardless, since it's against one of the design choices of Go, it'll be a bit of a hack. Instead of
go get github.com/pingcap/tidb@version-tag
, module users need to use this following way to get thepingcap/tidb
:(1) Search for the
tag
you want (in browser)(2) Get the
commit hash
for thetag
you want(3) Run
go get github.com/pingcap/tidb@commit-hash
(4) Edit the go.mod file to put a comment about which version you actually used
This will make it difficult for module users to get and upgrade
pingcap/tidb
.[*] You can see who will be affected here: [341 module users, e.g., ushell/yearning, chaos-mesh/go-sqlancer, chaos-mesh/horoscope]
https://github.com/search?q=pingcap%2Ftidb+filename%3Ago.mod&type=Code
Summary
You can make a choice to fix DM issues by balancing your own development schedules/mode against the affects on the downstream projects.
For this issue,
Solution 2
can maximize your benefits and with minimal impacts to your downstream projects the ecosystem.References
The text was updated successfully, but these errors were encountered: