PSA: go modules are almost here

212 views
Skip to first unread message

Jordan Liggitt

unread,
Apr 2, 2019, 6:19:13 PM4/2/19
to Kubernetes developer/contributor discussion

Fellow developers,


Let's take a moment to celebrate Godeps. It was there for us in the early days. It blazed multi-component GOPATHs with us. It watched with pride as its Godeps directory grew up into vendor. It watched with amusement as hotshots like glide and govendor jumped into the dependency management arena, staggered, and fell silent. It has been a faithful worker, but is now long in the tooth and is easily confused. You need only look into its eyes to see that our dependency tree causes it pain. So we're putting Godeps out to pasture. We found a nice home for it on a build farm, where it can run as long as it wants to ("this might take a while") and never think about a diamond dependency again.


… awkward moment of silence …


Anyway... work to switch Kubernetes and published staging repos to use go modules (KEP, kubernetes/kubernetes PR, publishing bot PR) will likely be landing in the next day. Once it merges, I'll send a follow-up email that the changes are live.


What does this mean for kubernetes/kubernetes developers?

  • Use go1.12+ (you have to anyway for k8s 1.15+)

  • To set the version of a dependency, run `hack/pin-dependency.sh`

    • E.g. hack/pin-dependency.sh github.com/docker/docker 501cb131a7b7

    • Run multiple times to set versions for multiple dependencies, if needed

    • After setting versions, run `hack/update-vendor.sh`

  • To rebuild the vendor dir, run `hack/update-vendor.sh` (this also updates the aggregated LICENSES file and updates go.mod files)

    • It is *much* faster than the godeps-restore/godeps-save update scripts:

      • ~3-4 minutes on first run

      • ~1-2 minutes on subsequent runs

    • It no longer messes with your $GOPATH contents at all

    • It works consistently across operating systems

    • Just like before, if you start (or stop) using a dependency in kubernetes/kubernetes or in one of the staging components, you may need to run this to update recorded dependencies


What does this mean for consumers of staging components (like k8s.io/client-go)?

go get -u k8s.io/client-go/...

go get -u k8s.io/apimachinery/...

cd $GOPATH/src/k8s.io/client-go

git checkout kubernetes-1.14.0

cd $GOPATH/src/k8s.io/apimachinery

git checkout kubernetes-1.14.0

  • Consumers using other dependency managers (like glide) which inspect Godeps.json files for dependency versions can continue to do so for the immediate future. Godeps.json files will continue to be published for staging component repos at least until go 1.13 is in use and go modules are enabled by default.

  • Instructions for other dependency managers that maintain their own version and lock files are generally unaffected by this change


We've tested the changes across multiple machines, environments, and done test publishing runs to make this as smooth a transition as possible, but if you encounter problems building, updating vendored dependencies, or using the published component repos after the changes go live, don't hesitate to open an issue (tag `/sig api-machinery` and `/cc @liggitt @sttts` when you do).


Jordan

Davanum Srinivas

unread,
Apr 2, 2019, 6:20:18 PM4/2/19
to Jordan Liggitt, Kubernetes developer/contributor discussion
Great milestone Jordan, Stefan!! thanks for making this happen

--
You received this message because you are subscribed to the Google Groups "Kubernetes developer/contributor discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-de...@googlegroups.com.
To post to this group, send email to kuberne...@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-dev.
To view this discussion on the web visit https://groups.google.com/d/msgid/kubernetes-dev/CAMBP-pK5i5qBq1b54884%2BqUNy%2Br5foPNn2tkvM-Lc9a8JePAZQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


--
Davanum Srinivas :: https://twitter.com/dims

Michael Taufen

unread,
Apr 2, 2019, 6:24:18 PM4/2/19
to Davanum Srinivas, Jordan Liggitt, Kubernetes developer/contributor discussion
It has been an honor Godeps. Godspeed.


For more options, visit https://groups.google.com/d/optout.


--
Michael Taufen
Google SWE

Jordan Liggitt

unread,
Apr 4, 2019, 10:34:00 AM4/4/19
to
Go module support has merged to kubernetes/kubernetes and been published to staging repositories.

Consuming a staging repository (e.g. `go get k8s.io/client-go@master`) now pulls in a version of client-go that describes dependency information in a format go can understand. See https://git.k8s.io/client-go/INSTALL.md for details.

If you encounter problems building, updating vendored dependencies, or using the published component repos, don't hesitate to open an issue (tag `/sig api-machinery` and `/cc @liggitt @sttts` when you do).

Thanks,
Jordan
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages