From 8b758c78a33bbb569c2ebd44e5e9bfc1d31ae163 Mon Sep 17 00:00:00 2001 From: greatroar <61184462+greatroar@users.noreply.github.com> Date: Sun, 19 Sep 2021 15:57:43 +0200 Subject: [PATCH] Require Go 1.14 to build --- .github/workflows/tests.yml | 5 ----- CONTRIBUTING.md | 2 +- build.go | 14 +++----------- changelog/unreleased/pull-3519 | 6 ++++++ doc/020_installation.rst | 2 +- go.mod | 2 +- 6 files changed, 12 insertions(+), 19 deletions(-) create mode 100644 changelog/unreleased/pull-3519 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 723e234a6..c21c9c4bd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -45,11 +45,6 @@ jobs: os: ubuntu-latest test_fuse: true - - job_name: Linux - go: 1.13.x - os: ubuntu-latest - test_fuse: true - name: ${{ matrix.job_name }} Go ${{ matrix.go }} runs-on: ${{ matrix.os }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d6eb63c1e..2f6134e6a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -66,7 +66,7 @@ Development Environment The repository contains the code written for restic in the directories `cmd/` and `internal/`. -Restic requires Go version 1.13 or later for compiling. Clone the repo (without +Restic requires Go version 1.14 or later for compiling. Clone the repo (without having `$GOPATH` set) and `cd` into the directory: $ unset GOPATH diff --git a/build.go b/build.go index 71caf701c..aab0c1a12 100644 --- a/build.go +++ b/build.go @@ -35,6 +35,7 @@ // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +//go:build ignore_build_go // +build ignore_build_go package main @@ -123,17 +124,8 @@ func printEnv(env []string) { // build runs "go build args..." with GOPATH set to gopath. func build(cwd string, env map[string]string, args ...string) error { - a := []string{"build"} - - // try to remove all absolute paths from resulting binary - if goVersion.AtLeast(GoVersion{1, 13, 0}) { - // use the new flag introduced by Go 1.13 - a = append(a, "-trimpath") - } else { - // otherwise try to trim as many paths as possible - a = append(a, "-asmflags", fmt.Sprintf("all=-trimpath=%s", cwd)) - a = append(a, "-gcflags", fmt.Sprintf("all=-trimpath=%s", cwd)) - } + // -trimpath removes all absolute paths from the binary. + a := []string{"build", "-trimpath"} if enablePIE { a = append(a, "-buildmode=pie") diff --git a/changelog/unreleased/pull-3519 b/changelog/unreleased/pull-3519 new file mode 100644 index 000000000..39fa54599 --- /dev/null +++ b/changelog/unreleased/pull-3519 @@ -0,0 +1,6 @@ +Change: Require Go 1.14 or newer + +Restic now requires Go 1.14 to build. This allows it to use new +standard library features instead of an external dependency. + +https://github.com/restic/restic/issues/3519 diff --git a/doc/020_installation.rst b/doc/020_installation.rst index 5340be18e..9b9660922 100644 --- a/doc/020_installation.rst +++ b/doc/020_installation.rst @@ -255,7 +255,7 @@ From Source *********** restic is written in the Go programming language and you need at least -Go version 1.13. Building restic may also work with older versions of Go, +Go version 1.14. Building restic may also work with older versions of Go, but that's not supported. See the `Getting started `__ guide of the Go project for instructions how to install Go. diff --git a/go.mod b/go.mod index 1ba834aa3..317942723 100644 --- a/go.mod +++ b/go.mod @@ -36,4 +36,4 @@ require ( gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637 ) -go 1.13 +go 1.14