Skip to content

Commit

Permalink
Remove build dependency on godep
Browse files Browse the repository at this point in the history
Instead of using `godep path`, we can simply set the GOPATH directly to
point to the Godeps/_workspace. We can still use `godep` to manage the
dependencies on the Godeps/ tree, but we don't need to have it available
for straight builds from git.

v2: Rebased and moved to inside kube::setup_go_environment() function.

Tested:
- Built it without godep in $PATH:
  $ hack/build-go.sh
- Ran unit tests without godep in $PATH:
  $ hack/test-go.sh
- Retested after rebase.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
  • Loading branch information
filbranden committed Aug 28, 2014
1 parent 7e0c1fb commit 4df5573
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ The commands above will not work if there are more than one directory in ``$GOPA

### godep and dependency management

Kubernetes uses [godep](https://github.com/tools/godep) to manage dependencies. Please make sure that ``godep`` is installed and in your ``$PATH``.
Kubernetes uses [godep](https://github.com/tools/godep) to manage dependencies. It is not required for building Kubernetes but it is required when managing dependencies under the Godeps/ tree. Please make sure that ``godep`` is installed and in your ``$PATH``.

#### Installing godep
There are many ways to build and host go binaries. Here is an easy way to get utilities like ```godep``` installed:
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started-guides/gce.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
4. You must have Go (version 1.2 or later) installed: [www.golang.org](http://www.golang.org).
5. You must have the [`gcloud` components](https://developers.google.com/cloud/sdk/) installed.
6. Ensure that your `gcloud` components are up-to-date by running `gcloud components update`.
7. Install godep. [Instructions here](https://github.com/GoogleCloudPlatform/kubernetes#installing-godep)
7. Install godep (optional, only required when modifying package dependencies). [Instructions here](https://github.com/GoogleCloudPlatform/kubernetes#installing-godep)
8. Get the Kubernetes source:

git clone https://github.com/GoogleCloudPlatform/kubernetes.git
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started-guides/vsphere.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
go get github.com/vmware/govmomi/govc
```

5. Install godep. [Instructions here](https://github.com/GoogleCloudPlatform/kubernetes#installing-godep)
5. Install godep (optional, only required when modifying package dependencies). [Instructions here](https://github.com/GoogleCloudPlatform/kubernetes#installing-godep)

6. Get the Kubernetes source:

Expand Down
16 changes: 5 additions & 11 deletions hack/config-go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ function gitcommit() {
return 0
}

# kube::setup_go_environment will check that `go` and `godep` commands are
# available in ${PATH}. If not running on Travis, it will also check that the Go
# version is good enough for the Kubernetes build.
# kube::setup_go_environment will check that the `go` commands is available in
# ${PATH}. If not running on Travis, it will also check that the Go version is
# good enough for the Kubernetes build.
#
# Also set ${GOPATH} and environment variables needed by Go.
kube::setup_go_environment() {
Expand All @@ -52,12 +52,6 @@ kube::setup_go_environment() {
exit 1
fi

if [[ -z "$(which godep)" ]]; then
echo "Can't find 'godep' in PATH, please fix and retry." >&2
echo "See https://github.com/GoogleCloudPlatform/kubernetes#godep-and-dependency-management" >&2
exit 1
fi

# Travis continuous build uses a head go release that doesn't report
# a version number, so we skip this check on Travis. Its unnecessary
# there anyway.
Expand All @@ -72,8 +66,8 @@ kube::setup_go_environment() {
fi
fi

# TODO: get rid of this after PR #1054 gets rid of godep.
GOPATH="${KUBE_TARGET}:$(godep path)"
# Set GOPATH to point to the tree maintained by `godep`.
GOPATH="${KUBE_TARGET}:${KUBE_REPO_ROOT}/Godeps/_workspace"
export GOPATH

# Unset GOBIN in case it already exsits in the current session.
Expand Down

0 comments on commit 4df5573

Please sign in to comment.