Stop doing vendoring - fixes #4032

This commit is contained in:
Nick Craig-Wood 2020-03-04 14:01:25 +00:00
parent 2b50d44a2f
commit d1617ce7ce
5 changed files with 30 additions and 46 deletions

View File

@ -19,13 +19,13 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: 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: include:
- job_name: linux - job_name: linux
os: ubuntu-latest os: ubuntu-latest
go: '1.14.x' go: '1.14.x'
modules: 'off' modules: 'on'
gotags: cmount gotags: cmount
build_flags: '-include "^linux/"' build_flags: '-include "^linux/"'
check: true check: true
@ -35,7 +35,7 @@ jobs:
- job_name: mac - job_name: mac
os: macOS-latest os: macOS-latest
go: '1.14.x' go: '1.14.x'
modules: 'off' modules: 'on'
gotags: '' # cmount doesn't work on osx travis for some reason gotags: '' # cmount doesn't work on osx travis for some reason
build_flags: '-include "^darwin/amd64" -cgo' build_flags: '-include "^darwin/amd64" -cgo'
quicktest: true quicktest: true
@ -45,7 +45,7 @@ jobs:
- job_name: windows_amd64 - job_name: windows_amd64
os: windows-latest os: windows-latest
go: '1.14.x' go: '1.14.x'
modules: 'off' modules: 'on'
gotags: cmount gotags: cmount
build_flags: '-include "^windows/amd64" -cgo' build_flags: '-include "^windows/amd64" -cgo'
quicktest: true quicktest: true
@ -55,7 +55,7 @@ jobs:
- job_name: windows_386 - job_name: windows_386
os: windows-latest os: windows-latest
go: '1.14.x' go: '1.14.x'
modules: 'off' modules: 'on'
gotags: cmount gotags: cmount
goarch: '386' goarch: '386'
cgo: '1' cgo: '1'
@ -66,12 +66,12 @@ jobs:
- job_name: other_os - job_name: other_os
os: ubuntu-latest os: ubuntu-latest
go: '1.14.x' go: '1.14.x'
modules: 'off' modules: 'on'
build_flags: '-exclude "^(windows/|darwin/amd64|linux/)"' build_flags: '-exclude "^(windows/|darwin/amd64|linux/)"'
compile_all: true compile_all: true
deploy: true deploy: true
- job_name: modules_race - job_name: race
os: ubuntu-latest os: ubuntu-latest
go: '1.14.x' go: '1.14.x'
modules: 'on' modules: 'on'
@ -81,19 +81,19 @@ jobs:
- job_name: go1.11 - job_name: go1.11
os: ubuntu-latest os: ubuntu-latest
go: '1.11.x' go: '1.11.x'
modules: 'off' modules: 'on'
quicktest: true quicktest: true
- job_name: go1.12 - job_name: go1.12
os: ubuntu-latest os: ubuntu-latest
go: '1.12.x' go: '1.12.x'
modules: 'off' modules: 'on'
quicktest: true quicktest: true
- job_name: go1.13 - job_name: go1.13
os: ubuntu-latest os: ubuntu-latest
go: '1.13.x' go: '1.13.x'
modules: 'off' modules: 'on'
quicktest: true quicktest: true
name: ${{ matrix.job_name }} name: ${{ matrix.job_name }}
@ -244,7 +244,7 @@ jobs:
- name: Build rclone - name: Build rclone
run: | run: |
docker pull golang 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 - name: Upload artifacts
run: | run: |

View File

@ -186,7 +186,6 @@ with modules beneath.
* pacer - retries with backoff and paces operations * pacer - retries with backoff and paces operations
* readers - a selection of useful io.Readers * readers - a selection of useful io.Readers
* rest - a thin abstraction over net/http for REST * 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 * vfs - Virtual FileSystem layer for implementing rclone mount and similar
## Writing Documentation ## ## Writing Documentation ##
@ -266,41 +265,25 @@ rclone uses the [go
modules](https://tip.golang.org/cmd/go/#hdr-Modules__module_versions__and_more) modules](https://tip.golang.org/cmd/go/#hdr-Modules__module_versions__and_more)
support in go1.11 and later to manage its dependencies. 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 can be built with modules outside of the GOPATH
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.
To add a dependency `github.com/ncw/new_dependency` see the To add a dependency `github.com/ncw/new_dependency` see the
instructions below. These will fetch the dependency, add it to instructions below. These will fetch the dependency and add it to
`go.mod` and `go.sum` and vendor it for older go versions. `go.mod` and `go.sum`.
GO111MODULE=on go get github.com/ncw/new_dependency 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 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. go docs linked above), but don't unless you really need to.
Please check in the changes generated by `go mod` including the Please check in the changes generated by `go mod` including `go.mod`
`vendor` directory and `go.mod` and `go.sum` in a single commit and `go.sum` in the same commit as your other changes.
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 ## ## Updating a dependency ##
If you need to update a dependency then run If you need to update a dependency then run
GO111MODULE=on go get -u github.com/pkg/errors GO111MODULE=on go get -u github.com/pkg/errors
GO111MODULE=on go mod vendor
Check in a single commit as above. Check in a single commit as above.

View File

@ -27,7 +27,7 @@ ifndef RELEASE_TAG
TAG := $(TAG)-beta TAG := $(TAG)-beta
endif endif
GO_VERSION := $(shell go version) GO_VERSION := $(shell go version)
GO_FILES := $(shell go list ./... | grep -v /vendor/ ) GO_FILES := $(shell go list ./... )
ifdef BETA_SUBDIR ifdef BETA_SUBDIR
BETA_SUBDIR := /$(BETA_SUBDIR) BETA_SUBDIR := /$(BETA_SUBDIR)
endif endif
@ -100,15 +100,19 @@ release_dep_windows:
GO111MODULE=off GOOS="" GOARCH="" go get github.com/josephspurrier/goversioninfo/cmd/goversioninfo GO111MODULE=off GOOS="" GOARCH="" go get github.com/josephspurrier/goversioninfo/cmd/goversioninfo
# Update dependencies # 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: 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 tidy
GO111MODULE=on go mod vendor
# Tidy the module dependencies # Tidy the module dependencies
tidy: tidy:
GO111MODULE=on go mod tidy GO111MODULE=on go mod tidy
GO111MODULE=on go mod vendor
doc: rclone.1 MANUAL.html MANUAL.txt rcdocs commanddocs doc: rclone.1 MANUAL.html MANUAL.txt rcdocs commanddocs

View File

@ -33,7 +33,7 @@ This file describes how to make the various kinds of releases
* make startdev * make startdev
* # announce with forum post, twitter post, patreon post * # 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 * Review any pinned packages in go.mod and remove if possible
* make update * make update
@ -53,7 +53,6 @@ Can be fixed with
* GO111MODULE=on go get -u github.com/russross/blackfriday@v1.5.2 * GO111MODULE=on go get -u github.com/russross/blackfriday@v1.5.2
* GO111MODULE=on go mod tidy * GO111MODULE=on go mod tidy
* GO111MODULE=on go mod vendor
## Making a point release ## Making a point release

View File

@ -174,7 +174,7 @@ kill %1
## Install from source ## ## 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 installed. [Download go](https://golang.org/dl/) if necessary. The
latest release is recommended. Then latest release is recommended. Then
@ -183,16 +183,14 @@ latest release is recommended. Then
go build go build
./rclone version ./rclone version
You can also build and install rclone in the This will leave you a checked out version of rclone you can modify.
[GOPATH](https://github.com/golang/go/wiki/GOPATH) (which defaults to
`~/go`) with: You can also build rclone with:
go get -u -v github.com/rclone/rclone go get -u -v github.com/rclone/rclone
and this will build the binary in `$GOPATH/bin` (`~/go/bin/rclone` by and this will build the binary in `$GOPATH/bin` (`~/go/bin/rclone` by
default) after downloading the source to default) after downloading the source to the go module cache..
`$GOPATH/src/github.com/rclone/rclone` (`~/go/src/github.com/rclone/rclone`
by default).
## Installation with Ansible ## ## Installation with Ansible ##