Skip to content

Commit

Permalink
Merge pull request #622 from erikh/fix-godeps
Browse files Browse the repository at this point in the history
Godeps,vendor: Cleanup godeps + update contivmodel to be threadsafe
  • Loading branch information
Joji Mekkatt authored Nov 22, 2016
2 parents e76ca68 + a80c0a2 commit 4e8b732
Show file tree
Hide file tree
Showing 957 changed files with 715 additions and 331,542 deletions.
318 changes: 166 additions & 152 deletions Godeps/Godeps.json

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ default: build
deps:
./scripts/deps

godep-save:
rm -rf vendor Godeps
godep save ./...

godep-restore:
godep restore ./...

gofmt-src: $(PKG_DIRS)
$(info +++ gofmt $(PKG_DIRS))
@for dir in $?; do $(GOFMT_CMD) $${dir} | grep "go"; [[ $$? -ne 0 ]] || exit 1; done
Expand Down
87 changes: 20 additions & 67 deletions docs/GoDep.md
Original file line number Diff line number Diff line change
@@ -1,76 +1,29 @@
# Dependency management in netplugin
This document explains the steps for vendoring update packages in netplugin
This document explains the steps for vendoring update packages in netplugin.

## Table of Contents
- [Audience](#audience)
- [Restoring dependencies](#restoring-dependencies)
- [Adding new dependencies](#adding-new-dependencies)
- [Updating existing dependencies](#updating-existing-dependencies)
## Obtaining Godep

## Audience
This document is targeted towards the developers looking into or working on
adding/updating vendored packages in netplugin/Godeps.

## Restoring dependencies
- netplugin/Godeps/Godeps.json has information about the vendored packages.
- `godep restore` can be used to copy these packages to $GOPATH/src
- It restores the packages in $GOPATH to a state expected by netplugin
- note: changes(if any) in $GOPATH/src will be over-written
```
cd netplugin
godep restore
```bash
$ go get -d -u github.com/tools/godep
```

## Adding new dependencies
## Make Tasks

- Add the new package to your $GOPATH/src
```
go get pkg_url
```
Please review the make tasks in the
[Makefile](https://github.com/contiv/netplugin/blob/master/Makefile) to see how
these tasks are implemented, they will assist with debugging godep issues in
your `$GOPATH`, etc.

- From within the netplugin directory run `godep save`, which will copy relevant
packages from `$GOPATH/src` to `netplugin/Godeps/_workspace`. It will also update
`netplugin/Godeps/Godeps.json`

```
cd netplugin
godep save ./...
```

- Verify the changes by running `git status` in netplugin directory.
Verify that package is added to `Godeps/_workspace/src` and that
`Godeps/Godeps.json` also reflects it

```
git status
```

## Updating existing dependencies
- Go to the `$GOPATH/directory` which hosts the package and update the package
```
cd $GOPATH/src/github.com/samalba/dockerclient
# update the package to the master
git checkout master
```

- From within the netplugin directory execute a `godep update pkg` to update the
Godeps
```
godep udpate github.com/samalba/dockerclient
```

In case above does not work try update as follows:
```
godep udpate github.com/samalba/dockerclient/...
```

- Verify the changes by running `git status` in netplugin directory.
Verify that package is added to `Godeps/_workspace/src` and that
`Godeps/Godeps.json` also reflects the version change

```
git status
```
* `make godep-save` saves the godeps from your `$GOPATH` to the repository,
overwiting all Godeps as necessary.
* `make godep-restore` restores the godeps to your `$GOPATH`, populating or
changing the revisions as necessary of the repositories within.

## Workflow

1. `make godep-restore` to update your repositories with the latest godeps we use.
1. Enter your `$GOPATH` and make the revisions you need or check out the versions you want.
* all changes must be committed, godep does not work with uncommitted data in any repository.
1. `make godep-save` to commit your changes from `$GOPATH` to the repository.
1. `git add vendor Godeps` to add your changes and `git commit -s` to commit them to the repository.
* **it is strongly advised you do this in a commit with just these changes to avoid problems with rebasing later**
180 changes: 0 additions & 180 deletions vendor/github.com/contiv/Godeps/Godeps.json

This file was deleted.

5 changes: 0 additions & 5 deletions vendor/github.com/contiv/Godeps/Readme

This file was deleted.

2 changes: 0 additions & 2 deletions vendor/github.com/contiv/Godeps/_workspace/.gitignore

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 4e8b732

Please sign in to comment.