Using an "internal" repo or org vs. vendor

88 views
Skip to first unread message

Tim Hockin

unread,
Apr 25, 2022, 12:59:10 PM4/25/22
to golang-nuts
We have some packages we would like to break out into their own repos,
but which we don't really want anyone outside of our project to depend
on.

We could, of course, just document that. But I had this thought that
maybe Go's "internal" semantics could be applied here. So as a test,
we redirected go-get of `k8s.io/internal` to a different github org
(e.g. go get k8s.io/internal/foo -> github.com/k8s-internal/foo).

This SEEMS to work until vendoring comes in, and we get errors like:

```
package k8s.io/kubernetes/cmd/genkubedocs
imports k8s.io/kubernetes/cmd/kubelet/app
imports k8s.io/kubernetes/pkg/kubelet
imports k8s.io/kubernetes/pkg/kubelet/images
pkg/kubelet/images/image_manager.go:26:2: use of internal package
k8s.io/kubernetes/vendor/k8s.io/internal/distribution/reference not
allowed
```

The code in `k8s.io/kubernetes/pkg/kubelet/images` imports
`k8s.io/internal/distribution/reference` but vendoring renames it
internally and now it fails the "internal" rules.

Is this perceived as a bug or just a case of "too clever for our own good" ?

Tim

Sean Liao

unread,
Apr 25, 2022, 3:14:42 PM4/25/22
to golang-nuts
Back in 2016 the decision was "working as intended", ref: https://github.com/golang/go/issues/16622#issuecomment-255391314

- sean


--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAO_RewbsnD4sH5Mqc41du0DYSsSBsnVmGi7nmW0MJpvA06_M5Q%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages