Skip to content

Commit

Permalink
Stop doing vendoring - fixes rclone#4032
Browse files Browse the repository at this point in the history
  • Loading branch information
ncw committed Jul 21, 2020
1 parent 2b50d44 commit d1617ce
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 46 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ jobs:
strategy:
fail-fast: false
matrix:
job_name: ['linux', 'mac', 'windows_amd64', 'windows_386', 'other_os', 'modules_race', 'go1.11', 'go1.12', 'go1.13']
job_name: ['linux', 'mac', 'windows_amd64', 'windows_386', 'other_os', 'race', 'go1.11', 'go1.12', 'go1.13']

include:
- job_name: linux
os: ubuntu-latest
go: '1.14.x'
modules: 'off'
modules: 'on'
gotags: cmount
build_flags: '-include "^linux/"'
check: true
Expand All @@ -35,7 +35,7 @@ jobs:
- job_name: mac
os: macOS-latest
go: '1.14.x'
modules: 'off'
modules: 'on'
gotags: '' # cmount doesn't work on osx travis for some reason
build_flags: '-include "^darwin/amd64" -cgo'
quicktest: true
Expand All @@ -45,7 +45,7 @@ jobs:
- job_name: windows_amd64
os: windows-latest
go: '1.14.x'
modules: 'off'
modules: 'on'
gotags: cmount
build_flags: '-include "^windows/amd64" -cgo'
quicktest: true
Expand All @@ -55,7 +55,7 @@ jobs:
- job_name: windows_386
os: windows-latest
go: '1.14.x'
modules: 'off'
modules: 'on'
gotags: cmount
goarch: '386'
cgo: '1'
Expand All @@ -66,12 +66,12 @@ jobs:
- job_name: other_os
os: ubuntu-latest
go: '1.14.x'
modules: 'off'
modules: 'on'
build_flags: '-exclude "^(windows/|darwin/amd64|linux/)"'
compile_all: true
deploy: true

- job_name: modules_race
- job_name: race
os: ubuntu-latest
go: '1.14.x'
modules: 'on'
Expand All @@ -81,19 +81,19 @@ jobs:
- job_name: go1.11
os: ubuntu-latest
go: '1.11.x'
modules: 'off'
modules: 'on'
quicktest: true

- job_name: go1.12
os: ubuntu-latest
go: '1.12.x'
modules: 'off'
modules: 'on'
quicktest: true

- job_name: go1.13
os: ubuntu-latest
go: '1.13.x'
modules: 'off'
modules: 'on'
quicktest: true

name: ${{ matrix.job_name }}
Expand Down Expand Up @@ -244,7 +244,7 @@ jobs:
- name: Build rclone
run: |
docker pull golang
docker run --rm -v "$PWD":/usr/src/rclone -w /usr/src/rclone golang go build -mod=vendor -v
docker run --rm -v "$PWD":/usr/src/rclone -w /usr/src/rclone golang go build -mod=mod -v
- name: Upload artifacts
run: |
Expand Down
27 changes: 5 additions & 22 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ 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 `go mod`
* vfs - Virtual FileSystem layer for implementing rclone mount and similar

## Writing Documentation ##
Expand Down Expand Up @@ -266,41 +265,25 @@ 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.

**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.

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.

The `vendor` directory is entirely managed by the `go mod` tool, do
not add things manually.
rclone can be built with modules outside of the GOPATH

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.
instructions below. These will fetch the dependency and add it to
`go.mod` and `go.sum`.

GO111MODULE=on go get github.com/ncw/new_dependency
GO111MODULE=on 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`.
Please check in the changes generated by `go mod` including `go.mod`
and `go.sum` in the same commit as your other changes.

## Updating a dependency ##

If you need to update a dependency then run

GO111MODULE=on go get -u github.com/pkg/errors
GO111MODULE=on go mod vendor

Check in a single commit as above.

Expand Down
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ifndef RELEASE_TAG
TAG := $(TAG)-beta
endif
GO_VERSION := $(shell go version)
GO_FILES := $(shell go list ./... | grep -v /vendor/ )
GO_FILES := $(shell go list ./... )
ifdef BETA_SUBDIR
BETA_SUBDIR := /$(BETA_SUBDIR)
endif
Expand Down Expand Up @@ -100,15 +100,19 @@ release_dep_windows:
GO111MODULE=off GOOS="" GOARCH="" go get github.com/josephspurrier/goversioninfo/cmd/goversioninfo

# Update dependencies
showupdates:
@echo "*** Direct dependencies that could be updated ***"
@GO111MODULE=on go list -u -f '{{if (and (not (or .Main .Indirect)) .Update)}}{{.Path}}: {{.Version}} -> {{.Update.Version}}{{end}}' -m all 2> /dev/null

# Update direct and indirect dependencies and test dependencies
update:
GO111MODULE=on go get -u ./...
GO111MODULE=on go get -u -t ./...
-#GO111MODULE=on go get -d $(go list -m -f '{{if not (or .Main .Indirect)}}{{.Path}}{{end}}' all)
GO111MODULE=on go mod tidy
GO111MODULE=on go mod vendor

# Tidy the module dependencies
tidy:
GO111MODULE=on go mod tidy
GO111MODULE=on go mod vendor

doc: rclone.1 MANUAL.html MANUAL.txt rcdocs commanddocs

Expand Down
3 changes: 1 addition & 2 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ This file describes how to make the various kinds of releases
* make startdev
* # announce with forum post, twitter post, patreon post

Early in the next release cycle update the vendored dependencies
Early in the next release cycle update the dependencies

* Review any pinned packages in go.mod and remove if possible
* make update
Expand All @@ -53,7 +53,6 @@ Can be fixed with

* GO111MODULE=on go get -u github.com/russross/[email protected]
* GO111MODULE=on go mod tidy
* GO111MODULE=on go mod vendor


## Making a point release
Expand Down
12 changes: 5 additions & 7 deletions docs/content/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ kill %1

## Install from source ##

Make sure you have at least [Go](https://golang.org/) 1.10
Make sure you have at least [Go](https://golang.org/) 1.11
installed. [Download go](https://golang.org/dl/) if necessary. The
latest release is recommended. Then

Expand All @@ -183,16 +183,14 @@ latest release is recommended. Then
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:
This will leave you a checked out version of rclone you can modify.

You can also build rclone with:

go get -u -v github.com/rclone/rclone

and this will build the binary in `$GOPATH/bin` (`~/go/bin/rclone` by
default) after downloading the source to
`$GOPATH/src/github.com/rclone/rclone` (`~/go/src/github.com/rclone/rclone`
by default).
default) after downloading the source to the go module cache..

## Installation with Ansible ##

Expand Down

0 comments on commit d1617ce

Please sign in to comment.