From 7c23381a2b749d480157245ff080e276af98eafd Mon Sep 17 00:00:00 2001
From: Michael Eischer <michael.eischer@fau.de>
Date: Wed, 22 Jul 2020 23:35:10 +0200
Subject: [PATCH] Drop support for Go version 1.11

---
 .travis.yml                           |  8 -----
 CONTRIBUTING.md                       | 43 ++++-----------------------
 build.go                              |  6 ++--
 changelog/unreleased/pull-2600        |  5 ++--
 doc/020_installation.rst              |  2 +-
 internal/restic/node_freebsd.go       |  2 +-
 internal/restic/node_freebsd_go111.go | 17 -----------
 run_integration_tests.go              |  2 +-
 8 files changed, 14 insertions(+), 71 deletions(-)
 delete mode 100644 internal/restic/node_freebsd_go111.go

diff --git a/.travis.yml b/.travis.yml
index db4810fea..6786e39ca 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,14 +3,6 @@ sudo: false
 
 matrix:
   include:
-    - os: linux
-      go: "1.11.x"
-      env: RESTIC_TEST_FUSE=0 RESTIC_TEST_CLOUD_BACKENDS=0
-      cache:
-        directories:
-          - $HOME/.cache/go-build
-          - $HOME/gopath/pkg/mod
-
     - os: linux
       go: "1.12.x"
       env: RESTIC_TEST_FUSE=0 RESTIC_TEST_CLOUD_BACKENDS=0
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 9cbde976c..599a8fd25 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -60,16 +60,11 @@ uploading it somewhere or post only the parts that are really relevant.
 Development Environment
 =======================
 
-The repository contains several sets of directories with code: `cmd/` and
-`internal/` contain the code written for restic, whereas `vendor/` contains
-copies of libraries restic depends on. The libraries are managed with the
-command `go mod vendor`.
+The repository contains the code written for restic in the directories
+`cmd/` and `internal/`.
 
-Go >= 1.11
-----------
-
-For Go version 1.11 or later, you should clone the repo (without having
-`$GOPATH` set) and `cd` into the directory:
+Restic requires Go version 1.12 or later for compiling. Clone the repo (without
+having `$GOPATH` set) and `cd` into the directory:
 
     $ unset GOPATH
     $ git clone https://github.com/restic/restic
@@ -79,40 +74,12 @@ Then use the `go` tool to build restic:
 
     $ go build ./cmd/restic
     $ ./restic version
-    restic 0.9.2-dev (compiled manually) compiled with go1.11 on linux/amd64
+    restic 0.9.6-dev (compiled manually) compiled with go1.14 on linux/amd64
 
 You can run all tests with the following command:
 
     $ go test ./...
 
-Go < 1.11
----------
-
-In order to compile restic with Go before 1.11, it needs to be checked out at
-the right path within a `GOPATH`. The concept of a `GOPATH` is explained in
-["How to write Go code"](https://golang.org/doc/code.html).
-
-If you do not have a directory with Go code yet, executing the following
-instructions in your shell will create one for you and check out the restic
-repo:
-
-    $ export GOPATH="$HOME/go"
-    $ mkdir -p "$GOPATH/src/github.com/restic"
-    $ cd "$GOPATH/src/github.com/restic"
-    $ git clone https://github.com/restic/restic
-    $ cd restic
-
-You can then build restic as follows:
-
-    $ go build ./cmd/restic
-    $ ./restic version
-    restic compiled manually
-    compiled with go1.8.3 on linux/amd64
-
-The following commands can be used to run all the tests:
-
-    $ go test ./...
-
 Providing Patches
 =================
 
diff --git a/build.go b/build.go
index eeda5a41e..71caf701c 100644
--- a/build.go
+++ b/build.go
@@ -3,7 +3,7 @@
 // This program aims to make building Go programs for end users easier by just
 // calling it with `go run`, without having to setup a GOPATH.
 //
-// This program needs Go >= 1.11. It'll use Go modules for compilation. It
+// This program needs Go >= 1.12. It'll use Go modules for compilation. It
 // builds the package configured as Main in the Config struct.
 
 // BSD 2-Clause License
@@ -327,8 +327,8 @@ func (v GoVersion) String() string {
 }
 
 func main() {
-	if !goVersion.AtLeast(GoVersion{1, 11, 0}) {
-		die("Go version (%v) is too old, Go <= 1.11 does not support Go Modules\n", goVersion)
+	if !goVersion.AtLeast(GoVersion{1, 12, 0}) {
+		die("Go version (%v) is too old, restic requires Go >= 1.12\n", goVersion)
 	}
 
 	if !goVersion.AtLeast(config.MinVersion) {
diff --git a/changelog/unreleased/pull-2600 b/changelog/unreleased/pull-2600
index 24722295b..5c8dc74b3 100644
--- a/changelog/unreleased/pull-2600
+++ b/changelog/unreleased/pull-2600
@@ -1,6 +1,7 @@
-Change: Require Go >= 1.11
+Change: Require Go >= 1.12
 
-Restic now requires Go to be at least 1.11. This allows simplifications in the
+Restic now requires Go to be at least 1.12. This allows simplifications in the
 build process and removing workarounds.
 
 https://github.com/restic/restic/pull/2600
+https://github.com/restic/restic/pull/2852
diff --git a/doc/020_installation.rst b/doc/020_installation.rst
index 92361984d..d4e4bd95d 100644
--- a/doc/020_installation.rst
+++ b/doc/020_installation.rst
@@ -245,7 +245,7 @@ From Source
 ***********
 
 restic is written in the Go programming language and you need at least
-Go version 1.11. Building restic may also work with older versions of Go,
+Go version 1.12. Building restic may also work with older versions of Go,
 but that's not supported. See the `Getting
 started <https://golang.org/doc/install>`__ guide of the Go project for
 instructions how to install Go.
diff --git a/internal/restic/node_freebsd.go b/internal/restic/node_freebsd.go
index d9baaca01..a8df07575 100644
--- a/internal/restic/node_freebsd.go
+++ b/internal/restic/node_freebsd.go
@@ -1,4 +1,4 @@
-// +build freebsd,go1.12
+// +build freebsd
 
 package restic
 
diff --git a/internal/restic/node_freebsd_go111.go b/internal/restic/node_freebsd_go111.go
deleted file mode 100644
index 8597b1770..000000000
--- a/internal/restic/node_freebsd_go111.go
+++ /dev/null
@@ -1,17 +0,0 @@
-// +build freebsd,!go1.12
-
-package restic
-
-import "syscall"
-
-func (node Node) restoreSymlinkTimestamps(path string, utimes [2]syscall.Timespec) error {
-	return nil
-}
-
-func (node Node) device() int {
-	return int(node.Device)
-}
-
-func (s statUnix) atim() syscall.Timespec { return s.Atimespec }
-func (s statUnix) mtim() syscall.Timespec { return s.Mtimespec }
-func (s statUnix) ctim() syscall.Timespec { return s.Ctimespec }
diff --git a/run_integration_tests.go b/run_integration_tests.go
index 5de573644..a5e2ccb47 100644
--- a/run_integration_tests.go
+++ b/run_integration_tests.go
@@ -362,7 +362,7 @@ func (env *TravisEnvironment) RunTests() error {
 			return err
 		}
 	} else {
-		msg("Skipping gofmt and module vendor check for %v\n", v)
+		msg("Skipping gofmt and mod tidy check for %v\n", v)
 	}
 
 	if err = runGlyphcheck(); err != nil {