diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 16dc2ac72..a1acf9c45 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -33,7 +33,7 @@ page](https://github.com/ncw/rclone). Now in your terminal - go get github.com/ncw/rclone + go get -u github.com/ncw/rclone cd $GOPATH/src/github.com/ncw/rclone git remote rename origin upstream git remote add origin git@github.com:YOURUSER/rclone.git @@ -166,7 +166,7 @@ with modules beneath. * pacer - retries with backoff and paces operations * readers - a selection of useful io.Readers * rest - a thin abstraction over net/http for REST - * vendor - 3rd party code managed by the dep tool + * vendor - 3rd party code managed by `go mod` * vfs - Virtual FileSystem layer for implementing rclone mount and similar ## Writing Documentation ## @@ -229,37 +229,55 @@ Fixes #1498 ## Adding a dependency ## -rclone uses the [dep](https://github.com/golang/dep) tool to manage -its dependencies. All code that rclone needs for building is stored -in the `vendor` directory for perfectly reproducable builds. +rclone uses the [go +modules](https://tip.golang.org/cmd/go/#hdr-Modules__module_versions__and_more) +support in go1.11 and later to manage its dependencies. -The `vendor` directory is entirely managed by the `dep` tool. +**NB** you must be using go1.11 or above to add a dependency to +rclone. Rclone will still build with older versions of go, but we use +the `go mod` command for dependencies which is only in go1.11 and +above. -To add a new dependency, run `dep ensure` and `dep` will pull in the -new dependency to the `vendor` directory and update the `Gopkg.lock` -file. +rclone can be built with modules outside of the GOPATH, but for +backwards compatibility with older go versions, rclone also maintains +a `vendor` directory with all the external code rclone needs for +building. -You can add constraints on that package in the `Gopkg.toml` file (see -the `dep` documentation), but don't unless you really need to. +The `vendor` directory is entirely managed by the `go mod` tool, do +not add things manually. -Please check in the changes generated by `dep` including the `vendor` -directory and `Godep.toml` and `Godep.lock` in a single commit -separate from any other code changes. Watch out for new files in -`vendor`. +To add a dependency `github.com/ncw/new_dependency` see the +instructions below. These will fetch the dependency, add it to +`go.mod` and `go.sum` and vendor it for older go versions. + + export GO111MODULE=on + go get github.com/ncw/new_dependency + go mod vendor + +You can add constraints on that package when doing `go get` (see the +go docs linked above), but don't unless you really need to. + +Please check in the changes generated by `go mod` including the +`vendor` directory and `go.mod` and `go.sum` in a single commit +separate from any other code changes with the title "vendor: add +github.com/ncw/new_dependency". Remember to `git add` any new files +in `vendor`. ## Updating a dependency ## If you need to update a dependency then run - dep ensure -update github.com/pkg/errors + export GO111MODULE=on + go get -u github.com/pkg/errors + go mod vendor Check in in a single commit as above. ## Updating all the dependencies ## In order to update all the dependencies then run `make update`. This -just runs `dep ensure -update`. Check in the changes in a single -commit as above. +just uses the go modules to update all the modules to their latest +stable release. Check in the changes in a single commit as above. This should be done early in the release cycle to pick up new versions of packages in time for them to get some testing. diff --git a/Makefile b/Makefile index 20267de4f..1c553b872 100644 --- a/Makefile +++ b/Makefile @@ -83,7 +83,6 @@ ifdef FULL_TESTS go get -u github.com/kisielk/errcheck go get -u golang.org/x/tools/cmd/goimports go get -u github.com/golang/lint/golint - go get -u github.com/tools/godep endif # Get the release dependencies @@ -93,8 +92,9 @@ release_dep: # Update dependencies update: - go get -u github.com/golang/dep/cmd/dep - dep ensure -update -v + GO111MODULE=on go get -u ./... + GO111MODULE=on go tidy + GO111MODULE=on go vendor doc: rclone.1 MANUAL.html MANUAL.txt diff --git a/docs/content/install.md b/docs/content/install.md index 38747ad52..93674821c 100644 --- a/docs/content/install.md +++ b/docs/content/install.md @@ -1,7 +1,7 @@ --- title: "Install" description: "Rclone Installation" -date: "2016-03-28" +date: "2018-08-28" --- # Install # @@ -11,7 +11,7 @@ Rclone is a Go program and comes as a single binary file. ## Quickstart ## * [Download](/downloads/) the relevant binary. - * Unpack and the `rclone` binary. + * Extract the `rclone` or `rclone.exe` binary from the archive * Run `rclone config` to setup. See [rclone config docs](/docs/) for more details. See below for some expanded Linux / macOS instructions. @@ -83,16 +83,25 @@ Run `rclone config` to setup. See [rclone config docs](/docs/) for more details. ## Install from source ## -Make sure you have at least [Go](https://golang.org/) 1.6 installed. -Make sure your `GOPATH` is set, then: +Make sure you have at least [Go](https://golang.org/) 1.7 +installed. [Download go](https://golang.org/dl/) if necessary. The +latest release is recommended. Then + + git clone https://github.com/ncw/rclone.git + cd rclone + go build + ./rclone version + +You can also build and install rclone in the +[GOPATH](https://github.com/golang/go/wiki/GOPATH) (which defaults to +`~/go`) with: go get -u -v github.com/ncw/rclone -and this will build the binary in `$GOPATH/bin`. If you have built -rclone before then you will want to update its dependencies first with -this - - go get -u -v github.com/ncw/rclone/... +and this will build the binary in `$GOPATH/bin` (`~/go/bin/rclone` by +default) after downloading the source to +`$GOPATH/src/github.com/ncw/rclone` (`~/go/src/github.com/ncw/rclone` +by default). ## Installation with Ansible ##