diff --git a/Makefile b/Makefile index d63952742..afdb7d126 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ ifeq ($(ARCH),) ARCH=amd64 endif CURRENT_OS_ARCH=$(shell echo `go env GOOS`-`go env GOARCH`) -GO_BIN=$(shell if goecho `go env GOOS`-`go env GOARCH`) +GO_BIN=$(shell if [ "$GOBIN" != "" ]; then echo "$GOBIN"; else echo `go env GOPATH`/bin; fi) # NB because this outputs absolute file names, you have to be careful # if you're testing out the Makefile with `-W` (pretend a file is @@ -31,7 +31,7 @@ IMAGE_TAG:=$(shell ./docker/image-tag) VCS_REF:=$(shell git rev-parse HEAD) BUILD_DATE:=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ') -all: $(GOPATH)/bin/fluxctl $(GOPATH)/bin/fluxd $(GOPATH)/bin/helm-operator build/.flux.done build/.helm-operator.done +all: $(GO_BIN)/bin/fluxctl $(GO_BIN)/bin/fluxd $(GO_BIN)/bin/helm-operator build/.flux.done build/.helm-operator.done release-bins: for arch in amd64; do \ @@ -103,16 +103,16 @@ cache/%/helm-$(HELM_VERSION): docker/helm.version tar -m -C ./cache -xzf cache/$*/helm-$(HELM_VERSION).tar.gz $*/helm mv cache/$*/helm $@ -$(GOPATH)/bin/fluxctl: $(FLUXCTL_DEPS) -$(GOPATH)/bin/fluxctl: ./cmd/fluxctl/*.go +$(GO_BIN)/bin/fluxctl: $(FLUXCTL_DEPS) +$(GO_BIN)/bin/fluxctl: ./cmd/fluxctl/*.go go install ./cmd/fluxctl -$(GOPATH)/bin/fluxd: $(FLUXD_DEPS) -$(GOPATH)/bin/fluxd: cmd/fluxd/*.go +$(GO_BIN)/bin/fluxd: $(FLUXD_DEPS) +$(GO_BIN)/bin/fluxd: cmd/fluxd/*.go go install ./cmd/fluxd -$(GOPATH)/bin/helm-operator: $(HELM_OPERATOR_DEPS) -$(GOPATH)/bin/help-operator: cmd/helm-operator/*.go +$(GO_BIN)/bin/helm-operator: $(HELM_OPERATOR_DEPS) +$(GO_BIN)/bin/help-operator: cmd/helm-operator/*.go go install ./cmd/helm-operator integration-test: all diff --git a/site/building.md b/site/building.md index 7bab2dd7a..10f3d051b 100644 --- a/site/building.md +++ b/site/building.md @@ -5,21 +5,19 @@ menu_order: 80 # Build -You'll need a working `go` environment (official releases are build against `1.10`), -including the [`dep`](https://github.com/golang/dep#installation) tool. - +You'll need a working `go` environment version >= 1.11 (official releases are built against `1.12`). It's also expected that you have a Docker daemon for building images. -Ensure the repository is checked out into $GOPATH/src/github.com/weaveworks/flux. -Then, from the root, +Clone the respository. The project uses Go Modules, so if you explicitly define `$GOPATH` you should +clone somewhere else + +Then, from the root directory, ```sh -$ dep ensure -# .. time passes .. $ make ``` -This makes Docker images, and installs binaries to $GOPATH/bin. +This makes Docker images, and installs binaries to `$GOBIN` (if you define it) or `$(go env GOPATH)/bin`. Note: The default target architecture is amd64. If you would like to try to build Docker images and binaries for a different architecture you will have to set ARCH variable, @@ -34,16 +32,3 @@ $ make ARCH= $ make test ``` -# Dependency management - -We use [dep](https://github.com/golang/dep) to manage vendored dependencies. -Note that **we do not check in the dependencies**. - -To get all the dependencies put in the `vendor/` folder, use - -```sh -$ dep ensure -``` - -If you see a big diff or other unexpected output after running `dep ensure`, -make sure you're using the latest official release of `dep`.