Skip to content

Commit

Permalink
Merge pull request #319 from caesarxuchao/remove-dep
Browse files Browse the repository at this point in the history
Document that client-go is not yet compatible with dep
  • Loading branch information
caesarxuchao authored Nov 1, 2017
2 parents 98d1cb6 + 62be166 commit 72e1c2a
Showing 1 changed file with 17 additions and 35 deletions.
52 changes: 17 additions & 35 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,38 +143,20 @@ After modifying, run `glide up -v` again to re-populate your /vendor directory.
Optionally, Glide users can also use [`glide-vc`](https://github.com/sgotti/glide-vc)
after running `glide up -v` to remove unused files from /vendor.

### Dep

[dep](https://github.com/golang/dep) is an up-and-coming dependency management tool,
which has the goal of being accepted as part of the standard go toolchain. Its
status is currently alpha. However, it comes the closest to working easily out
of the box.

```sh
$ go get github.com/golang/dep
$ go install github.com/golang/dep/cmd/dep
# Make sure you have a go file in your directory which imports a package of
# k8s.io/client-go first--I suggest copying one of the examples.
$ dep init
$ dep ensure k8s.io/client-go@^2.0.0
```

Then you can try one of the
[examples](https://github.com/kubernetes/client-go/tree/v2.0.0/examples/) from
the 2.0.0 release.

This will set up a `vendor` directory in your current directory, add `k8s.io/client-go`
to it, and flatten all of `k8s.io/client-go`'s dependencies into that vendor directory,
so that your code and `client-go` will both get the same copy of each
dependency.

After installing like this, you could either use dep for your other
dependencies, or copy everything in the `vendor` directory into your
`$GOPATH/src` directory and proceed as if you had done a fancy `go get` that
flattened dependencies sanely.

One thing to note about dep is that it will omit dependencies that aren't
actually used, and some dependencies of `client-go` are used only if you import
one of the plugins (for example, the auth plugins). So you may need to run `dep
ensure` again if you start importing a plugin that you weren't using before.
### Dep (Not supported yet!)

[dep](https://github.com/golang/dep) is an up-and-coming dependency management
tool, which has the goal of being accepted as part of the standard go toolchain.
However, client-go does **NOT** work well with `dep` yet. To support `dep`, we
need to fix at least two issues:
1. publish native `Gopkg.toml` in client-go and other k8s.io repos, like `k8s.io/apimachinery`;
2. find a way to express transitive constraints (see https://github.com/golang/dep/issues/1124).

As a workaround, which may or may not be worthwhile, you can specify all
client-go dependencies manually as
[override](https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md#override)
in Gopkg.toml with the versions listed in [Godeps.json](./Godeps/Godeps.json),
and manually update them when you upgrade client-go version.

We are actively working on the two issues blocking using `dep`. For the
meantime, we recommend using `glide` or `godeps`.

0 comments on commit 72e1c2a

Please sign in to comment.