Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
Also, make everything work if `$GOBIN` is defined
  • Loading branch information
Alfonso Acosta committed May 23, 2019
1 parent a13748f commit fec89a0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 29 deletions.
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 \
Expand Down Expand Up @@ -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
Expand Down
27 changes: 6 additions & 21 deletions site/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -34,16 +32,3 @@ $ make ARCH=<target_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`.

0 comments on commit fec89a0

Please sign in to comment.