You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Request to create new release(s) for Go modules compatibility #39056
Hey Folks,
I couldn't find this discussed elsewhere, so I'm asking here: Would it be possible to create a new release (and hopefully restart the process of creating regular new releases)?
Background: Apparently there hasn't been a new release since June 2017 (v17.03.2-ce). I wouldn't really care about this, except that the Go language is moving to adopt modules (i.e. versioned releases of packages), and go uses the latest github release as the default version of a module to fetch. So by not updating releases here (AFAICT), it makes it confusing (though not impossible) to use Go modules with moby.
More background/repro is in this golang issue I filed.
Reacted by philtay, Tine Jozelj, deanrock, Nathan Mittler, pavan kumar achanta, Levi, Ludovic Fernandez, Nathan Sullivan, Maksym Trofimenko, Parth Parikh and 21 more
Releases are handled through github.com/docker/engine currently.
You should target the branch/tag for the release you are wanting to support.
The other part of this is Docker does not follow semver, and while generally we do try to not break the package level API's it does happen from time to time.
This does not follow with the go modules method of versioning and will require manual management.
Changing the versioning will not fix any problems caused by modules.
The fact that there are non-semver versions alone breaks automatic version selection.
That plus the fact that semver just does not make sense for the engine.
Having a library in a client lib in a separate repo which is semver kind of makes sense, but is hugely difficult to maintain.
For those wondering if there is a solution, yes! Use a "replace" directive and specify the docker/engine repo and tag that you want.
the "replace" directive is not transitive (if a project depends of a lib that specify the replace directive, the replace will not apply to the project), so it's an unstable solution.
On the maintainers call today we discussed making client a dedicated module with its own tags (ie client/ will get its own go.mod and special tags client/) which, in theory, should work with go get.
Reacted by Theodoor van Donge, David Wang, Ludovic Fernandez, Dominik Roos, Lukas Vogel, 7thzero and Bryan C. Mills
I'll bring this up again today. Really someone (a maintainer) just needs to do the work, but I'm definitely worried about breaking other consumers.
Basically, who are we going to break by making this change (I'm greater than 50% positive that it will break people)... is the number it will break higher or lower than the number of people currently feeling pain.
Another thing that is problematic is if we keep the current repo structure then we need 2 modules, one for api/types and one for client, and then we have to keep this things in sync somehow... or just move everything under a single package tree and break everyone.
I think the majority of the Go ecosystem is getting behind modules (no evidence other than my own experience), and while that might certainly not be a majority of users right now, it will be sooner or later. I'm not sure how adding the module would risk breaking current users?
Another thing that is problematic is if we keep the current repo structure then we need 2 modules, one for api/types and one for client, and then we have to keep this things in sync somehow... or just move everything under a single package tree and break everyone.
Do they need to be kept in sync? If the dependency relationship is a simple arrow (one depends on the other), then it should be possible to version them independently. I'm by no means an expert, but it also should be possible to experiment a little (as long as you're not cutting any new releases imminently).
Just to add some numbers to Johan’s comment (I hope you don’t mind): golang/go#38158 (comment). It looks indeed like quite a lot of the public repos have migrated to modules already!
the "replace" workaround mentioned above doesn't seem to work with newer versions.
I tried adding replace github.com/docker/docker => github.com/docker/docker v19.03.8 but go changes this to replace github.com/docker/docker => github.com/docker/docker v17.12.0-ce-rc1.0.20200309214505-aa6a9891b09c+incompatible
The strange version is because go modules doesn't support release branches, and assumes releases are only done from master; it therefore finds a branch point on the master branch (and only those that it assumes are SemVer), and picks that as "the version" to use for generating a pseudo-version.
As @cpuguy83 explained, it's the commit (last part) that's the actual version that go mod uses
FYI, the problem with go mod fetching v17.12.xxx instead of v19.03.xxx is related to the trailing zero not following semver compliance, that's why go fetches the nearest valid version (all v19 and v18 versions have a traling zero on the minor version number).
Is there any workaround for gomod? I'm not able to find a solution for this using go mod
Specify the tag of the release you want to use in your go.mod, and go modules will pick the correct commit. It will show the confusing "pseudo version" but the commit will match.
Make sure to specify the version though, otherwise go modules will pick a very old version (v1.13.1), which it thinks is the current "stable" release. Here's a quick example;
mkdir foobar &&cd foobar
Add a main.go
package main
import (
"fmt""github.com/docker/docker/api"
)
funcmain() {
fmt.Println("the API version is", api.DefaultVersion)
}
Initialize your module;
go mod init foobar
# go: creating new go.mod: module foobar
Specify the version of docker/docker you want to use in your go.mod;
I am no expert so I don't know whether it is go.mod's architectural, intented limitation, or it is really the moby maintainer needing to comply with semver compliance. Well, I am using go 1.16, maybe this is a non-problem in a more modern version of Go shrug
Activity
faraazahmad commentedon Apr 15, 2019
would this be related to why i am unable to
get get github.com/docker/docker/client?cpuguy83 commentedon Apr 15, 2019
Releases are handled through github.com/docker/engine currently.
You should target the branch/tag for the release you are wanting to support.
The other part of this is Docker does not follow semver, and while generally we do try to not break the package level API's it does happen from time to time.
This does not follow with the go modules method of versioning and will require manual management.
faraazahmad commentedon Apr 16, 2019
So should I
go get github.com/docker/engine?monkeyWie commentedon Jul 22, 2019
Hey, do we have a solution now?
ldez commentedon Aug 4, 2019
As the go modules will become the default/standard for Go projects, is it Docker/Moby will reevaluate its versioning policy?
cpuguy83 commentedon Aug 4, 2019
Changing the versioning will not fix any problems caused by modules.
The fact that there are non-semver versions alone breaks automatic version selection.
That plus the fact that semver just does not make sense for the engine.
Having a library in a client lib in a separate repo which is semver kind of makes sense, but is hugely difficult to maintain.
For those wondering if there is a solution, yes! Use a "replace" directive and specify the docker/engine repo and tag that you want.
ldez commentedon Aug 4, 2019
the "replace" directive is not transitive (if a project depends of a lib that specify the replace directive, the replace will not apply to the project), so it's an unstable solution.
But I understand your point.
ldez commentedon Aug 4, 2019
Sorry to bother you, are you planning to replace the
vendor.conffile withgo.mod?Even if you do not use semver.
cpuguy83 commentedon Feb 7, 2020
On the maintainers call today we discussed making client a dedicated module with its own tags (ie client/ will get its own go.mod and special tags client/) which, in theory, should work with go get.
johanbrandhorst commentedon Apr 2, 2020
To users of go.dev and the official docker client, this versioning is very confusing: https://pkg.go.dev/github.com/docker/docker/client?tab=versions. Apparently the latest version it
1.13.1, while@masteris currently detected asv1.4.2-0.20200331113714-bd81cf28590c. A separate module for the client would be greatly appreciated to fix this confusion.cpuguy83 commentedon Apr 2, 2020
I'll bring this up again today. Really someone (a maintainer) just needs to do the work, but I'm definitely worried about breaking other consumers.
Basically, who are we going to break by making this change (I'm greater than 50% positive that it will break people)... is the number it will break higher or lower than the number of people currently feeling pain.
Another thing that is problematic is if we keep the current repo structure then we need 2 modules, one for api/types and one for client, and then we have to keep this things in sync somehow... or just move everything under a single package tree and break everyone.
johanbrandhorst commentedon Apr 2, 2020
I think the majority of the Go ecosystem is getting behind modules (no evidence other than my own experience), and while that might certainly not be a majority of users right now, it will be sooner or later. I'm not sure how adding the module would risk breaking current users?
Do they need to be kept in sync? If the dependency relationship is a simple arrow (one depends on the other), then it should be possible to version them independently. I'm by no means an expert, but it also should be possible to experiment a little (as long as you're not cutting any new releases imminently).
leitzler commentedon Apr 2, 2020
Just to add some numbers to Johan’s comment (I hope you don’t mind): golang/go#38158 (comment). It looks indeed like quite a lot of the public repos have migrated to modules already!
cpuguy83 commentedon Apr 2, 2020
We don't use dep either, but also aren't using modules :)
leitzler commentedon Apr 2, 2020
I know, the comment include a lot of relevant numbers that can give a hint of modules adoption rate, regardless of earlier dependency management :)
SimSmith commentedon May 8, 2020
The Go Developer Survey 2019 also gives some additional numbers.
Among the respondents, 89% were using Go Modules.
https://blog.golang.org/survey2019-results
RX14 commentedon May 12, 2020
the "replace" workaround mentioned above doesn't seem to work with newer versions.
I tried adding
replace github.com/docker/docker => github.com/docker/docker v19.03.8but go changes this toreplace github.com/docker/docker => github.com/docker/docker v17.12.0-ce-rc1.0.20200309214505-aa6a9891b09c+incompatiblecpuguy83 commentedon May 12, 2020
Are you sure it's a problem? The first part of
-aa6a9891b09c+incompatibleis the commit for 19.03.8thaJeztah commentedon May 12, 2020
The strange version is because go modules doesn't support release branches, and assumes releases are only done from master; it therefore finds a branch point on the master branch (and only those that it assumes are SemVer), and picks that as "the version" to use for generating a pseudo-version.
As @cpuguy83 explained, it's the commit (last part) that's the actual version that go mod uses
rodrigocollavo commentedon May 25, 2020
FYI, the problem with go mod fetching v17.12.xxx instead of v19.03.xxx is related to the trailing zero not following semver compliance, that's why go fetches the nearest valid version (all v19 and v18 versions have a traling zero on the minor version number).
Is there any workaround for gomod? I'm not able to find a solution for this using go mod
johanbrandhorst commentedon May 25, 2020
This version works for me. You might even be able to tweak it to a specific commit yourself.
rodrigocollavo commentedon May 25, 2020
yes, but source code differs a lot from current master branch (19.x)
thaJeztah commentedon May 25, 2020
Specify the tag of the release you want to use in your
go.mod, and go modules will pick the correct commit. It will show the confusing "pseudo version" but the commit will match.Make sure to specify the version though, otherwise go modules will pick a very old version (v1.13.1), which it thinks is the current "stable" release. Here's a quick example;
Add a main.go
Initialize your module;
go mod init foobar # go: creating new go.mod: module foobarSpecify the version of docker/docker you want to use in your
go.mod;Build the binary and verify that the correct API version is used. In this case, go downloads the module (the pseudo version it generates and downloads uses
v17.12.0-ce-rc1, but the commit (811a247d06e8matches v19.03.9: https://github.com/moby/moby/releases/tag/v19.03.9)Update docker
Bump github.com/docker/docker to v17.09.1-ce
yeukhon commentedon Sep 30, 2022
If people still have this issue, just go to
go.modand update the version to whatever is found in https://pkg.go.dev/github.com/docker/docker/client?tab=versions (or whatever is latest in the release tag page).Example:
I am no expert so I don't know whether it is
go.mod's architectural, intented limitation, or it is really the moby maintainer needing to comply with semver compliance. Well, I am using go 1.16, maybe this is a non-problem in a more modern version of Go shrugthaJeztah commentedon Sep 17, 2023
not fully there yet, but at least the version format is more compatible (still needs
+incompatible)let me close this one for now