Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

build: drop support for go1.8

Nick Craig-Wood16d8014cbb17
diff --git a/.travis.yml b/.travis.yml
index a09fe4a22..e98b776f7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -49,9 +49,6 @@ matrix:
allow_failures:
- go: tip
include:
- - go: 1.8.x
- script:
- - make quicktest
- go: 1.9.x
script:
- make quicktest
diff --git a/backend/azureblob/azureblob.go b/backend/azureblob/azureblob.go
index 7b7110b7f..8adf4efd8 100644
--- a/backend/azureblob/azureblob.go
+++ b/backend/azureblob/azureblob.go
@@ -1,6 +1,6 @@
// Package azureblob provides an interface to the Microsoft Azure blob object storage system
-// +build !plan9,!solaris,go1.8
+// +build !plan9,!solaris
package azureblob
diff --git a/backend/azureblob/azureblob_internal_test.go b/backend/azureblob/azureblob_internal_test.go
index 849d08f08..0ccd006b6 100644
--- a/backend/azureblob/azureblob_internal_test.go
+++ b/backend/azureblob/azureblob_internal_test.go
@@ -1,4 +1,4 @@
-// +build !plan9,!solaris,go1.8
+// +build !plan9,!solaris
package azureblob
diff --git a/backend/azureblob/azureblob_test.go b/backend/azureblob/azureblob_test.go
index d676f5384..06b45808f 100644
--- a/backend/azureblob/azureblob_test.go
+++ b/backend/azureblob/azureblob_test.go
@@ -1,6 +1,6 @@
// Test AzureBlob filesystem interface
-// +build !plan9,!solaris,go1.8
+// +build !plan9,!solaris
package azureblob
diff --git a/backend/azureblob/azureblob_unsupported.go b/backend/azureblob/azureblob_unsupported.go
index 350bc2eaa..ba0f50a4f 100644
--- a/backend/azureblob/azureblob_unsupported.go
+++ b/backend/azureblob/azureblob_unsupported.go
@@ -1,6 +1,6 @@
// Build for azureblob for unsupported platforms to stop go complaining
// about "no buildable Go source files "
-// +build plan9 solaris !go1.8
+// +build plan9 solaris
package azureblob
diff --git a/backend/drive/drive.go b/backend/drive/drive.go
index 032e126fb..49e43c9a7 100644
--- a/backend/drive/drive.go
+++ b/backend/drive/drive.go
@@ -1,7 +1,4 @@
// Package drive interfaces with the Google Drive object storage system
-
-// +build go1.9
-
package drive
// FIXME need to deal with some corner cases
diff --git a/backend/drive/drive_internal_test.go b/backend/drive/drive_internal_test.go
index c1b9108f8..542fd5538 100644
--- a/backend/drive/drive_internal_test.go
+++ b/backend/drive/drive_internal_test.go
@@ -1,5 +1,3 @@
-// +build go1.9
-
package drive
import (
diff --git a/backend/drive/drive_test.go b/backend/drive/drive_test.go
index 1c13c3afc..0db327e47 100644
--- a/backend/drive/drive_test.go
+++ b/backend/drive/drive_test.go
@@ -1,7 +1,5 @@
// Test Drive filesystem interface
-// +build go1.9
-
package drive
import (
diff --git a/backend/drive/drive_unsupported.go b/backend/drive/drive_unsupported.go
deleted file mode 100644
index cbddea72a..000000000
--- a/backend/drive/drive_unsupported.go
+++ /dev/null
@@ -1,6 +0,0 @@
-// Build for unsupported platforms to stop go complaining
-// about "no buildable Go source files "
-
-// +build !go1.9
-
-package drive
diff --git a/backend/drive/upload.go b/backend/drive/upload.go
index b5dc7bbad..2dcecdefa 100644
--- a/backend/drive/upload.go
+++ b/backend/drive/upload.go
@@ -8,8 +8,6 @@
//
// This contains code adapted from google.golang.org/api (C) the GO AUTHORS
-// +build go1.9
-
package drive
import (
diff --git a/backend/googlecloudstorage/googlecloudstorage.go b/backend/googlecloudstorage/googlecloudstorage.go
index e72ab148a..71269e9d7 100644
--- a/backend/googlecloudstorage/googlecloudstorage.go
+++ b/backend/googlecloudstorage/googlecloudstorage.go
@@ -1,7 +1,4 @@
// Package googlecloudstorage provides an interface to Google Cloud Storage
-
-// +build go1.9
-
package googlecloudstorage
/*
diff --git a/backend/googlecloudstorage/googlecloudstorage_test.go b/backend/googlecloudstorage/googlecloudstorage_test.go
index 8b483f52f..cfb0bfdf0 100644
--- a/backend/googlecloudstorage/googlecloudstorage_test.go
+++ b/backend/googlecloudstorage/googlecloudstorage_test.go
@@ -1,7 +1,5 @@
// Test GoogleCloudStorage filesystem interface
-// +build go1.9
-
package googlecloudstorage_test
import (
diff --git a/backend/googlecloudstorage/googlecloudstorage_unsupported.go b/backend/googlecloudstorage/googlecloudstorage_unsupported.go
deleted file mode 100644
index 0a75c9de8..000000000
--- a/backend/googlecloudstorage/googlecloudstorage_unsupported.go
+++ /dev/null
@@ -1,6 +0,0 @@
-// Build for unsupported platforms to stop go complaining
-// about "no buildable Go source files "
-
-// +build !go1.9
-
-package googlecloudstorage
diff --git a/backend/http/http_internal_test.go b/backend/http/http_internal_test.go
index 97e00eca0..2c489879d 100644
--- a/backend/http/http_internal_test.go
+++ b/backend/http/http_internal_test.go
@@ -1,5 +1,3 @@
-// +build go1.8
-
package http
import (
diff --git a/backend/sftp/sftp.go b/backend/sftp/sftp.go
index baad34759..c42e94057 100644
--- a/backend/sftp/sftp.go
+++ b/backend/sftp/sftp.go
@@ -1,6 +1,6 @@
// Package sftp provides a filesystem interface using github.com/pkg/sftp
-// +build !plan9,go1.9
+// +build !plan9
package sftp
diff --git a/backend/sftp/sftp_internal_test.go b/backend/sftp/sftp_internal_test.go
index ad99ff7d2..5d2741885 100644
--- a/backend/sftp/sftp_internal_test.go
+++ b/backend/sftp/sftp_internal_test.go
@@ -1,4 +1,4 @@
-// +build !plan9,go1.9
+// +build !plan9
package sftp
diff --git a/backend/sftp/sftp_test.go b/backend/sftp/sftp_test.go
index 10d7376b2..9cf2cfa69 100644
--- a/backend/sftp/sftp_test.go
+++ b/backend/sftp/sftp_test.go
@@ -1,6 +1,6 @@
// Test Sftp filesystem interface
-// +build !plan9,go1.9
+// +build !plan9
package sftp_test
diff --git a/backend/sftp/sftp_unsupported.go b/backend/sftp/sftp_unsupported.go
index e9ecd15b0..daddf483b 100644
--- a/backend/sftp/sftp_unsupported.go
+++ b/backend/sftp/sftp_unsupported.go
@@ -1,6 +1,6 @@
// Build for sftp for unsupported platforms to stop go complaining
// about "no buildable Go source files "
-// +build plan9 !go1.9
+// +build plan9
package sftp
diff --git a/backend/sftp/stringlock.go b/backend/sftp/stringlock.go
index a1bfab41e..93c490edf 100644
--- a/backend/sftp/stringlock.go
+++ b/backend/sftp/stringlock.go
@@ -1,4 +1,4 @@
-// +build !plan9,go1.9
+// +build !plan9
package sftp
diff --git a/backend/sftp/stringlock_test.go b/backend/sftp/stringlock_test.go
index 6e368f45a..0c1941bb7 100644
--- a/backend/sftp/stringlock_test.go
+++ b/backend/sftp/stringlock_test.go
@@ -1,4 +1,4 @@
-// +build !plan9,go1.9
+// +build !plan9
package sftp
diff --git a/cmd/serve/dlna/dlna_test.go b/cmd/serve/dlna/dlna_test.go
index 8c5492117..577eda4a3 100644
--- a/cmd/serve/dlna/dlna_test.go
+++ b/cmd/serve/dlna/dlna_test.go
@@ -1,5 +1,3 @@
-// +build go1.8
-
package dlna
import (
diff --git a/cmd/serve/http/http_test.go b/cmd/serve/http/http_test.go
index fafd4cfe1..984348d1d 100644
--- a/cmd/serve/http/http_test.go
+++ b/cmd/serve/http/http_test.go
@@ -1,5 +1,3 @@
-// +build go1.8
-
package http
import (
diff --git a/cmd/serve/httplib/http_new.go b/cmd/serve/httplib/http_new.go
deleted file mode 100644
index 04f53428f..000000000
--- a/cmd/serve/httplib/http_new.go
+++ /dev/null
@@ -1,21 +0,0 @@
-// HTTP parts go1.8+
-
-//+build go1.8
-
-package httplib
-
-import (
- "net/http"
- "time"
-)
-
-// Initialise the http.Server for post go1.8
-func initServer(s *http.Server) {
- s.ReadHeaderTimeout = 10 * time.Second // time to send the headers
- s.IdleTimeout = 60 * time.Second // time to keep idle connections open
-}
-
-// closeServer closes the server in a non graceful way
-func closeServer(s *http.Server) error {
- return s.Close()
-}
diff --git a/cmd/serve/httplib/http_old.go b/cmd/serve/httplib/http_old.go
deleted file mode 100644
index 66c935130..000000000
--- a/cmd/serve/httplib/http_old.go
+++ /dev/null
@@ -1,18 +0,0 @@
-// HTTP parts pre go1.8
-
-//+build !go1.8
-
-package httplib
-
-import (
- "net/http"
-)
-
-// Initialise the http.Server for pre go1.8
-func initServer(s *http.Server) {
-}
-
-// closeServer closes the server in a non graceful way
-func closeServer(s *http.Server) error {
- return nil
-}
diff --git a/cmd/serve/httplib/httplib.go b/cmd/serve/httplib/httplib.go
index 43bfa42ec..2844b7c40 100644
--- a/cmd/serve/httplib/httplib.go
+++ b/cmd/serve/httplib/httplib.go
@@ -180,17 +180,17 @@ func NewServer(handler http.Handler, opt *Options) *Server {
// FIXME make a transport?
s.httpServer = &http.Server{
- Addr: s.Opt.ListenAddr,
- Handler: handler,
- ReadTimeout: s.Opt.ServerReadTimeout,
- WriteTimeout: s.Opt.ServerWriteTimeout,
- MaxHeaderBytes: s.Opt.MaxHeaderBytes,
+ Addr: s.Opt.ListenAddr,
+ Handler: handler,
+ ReadTimeout: s.Opt.ServerReadTimeout,
+ WriteTimeout: s.Opt.ServerWriteTimeout,
+ MaxHeaderBytes: s.Opt.MaxHeaderBytes,
+ ReadHeaderTimeout: 10 * time.Second, // time to send the headers
+ IdleTimeout: 60 * time.Second, // time to keep idle connections open
TLSConfig: &tls.Config{
MinVersion: tls.VersionTLS10, // disable SSL v3.0 and earlier
},
}
- // go version specific initialisation
- initServer(s.httpServer)
if s.Opt.ClientCA != "" {
if !s.useSSL {
@@ -267,7 +267,7 @@ func (s *Server) Wait() {
// Close shuts the running server down
func (s *Server) Close() {
- err := closeServer(s.httpServer)
+ err := s.httpServer.Close()
if err != nil {
log.Printf("Error on closing HTTP server: %v", err)
return
diff --git a/fs/rc/rcserver/rcserver_test.go b/fs/rc/rcserver/rcserver_test.go
index 6bd7d698f..54af53711 100644
--- a/fs/rc/rcserver/rcserver_test.go
+++ b/fs/rc/rcserver/rcserver_test.go
@@ -1,5 +1,3 @@
-// +build go1.8
-
package rcserver
import (
diff --git a/fs/versioncheck.go b/fs/versioncheck.go
index 96901db2d..03af486ea 100644
--- a/fs/versioncheck.go
+++ b/fs/versioncheck.go
@@ -1,7 +1,7 @@
-//+build !go1.8
+//+build !go1.9
package fs
-// Upgrade to Go version 1.8 to compile rclone - latest stable go
+// Upgrade to Go version 1.9 to compile rclone - latest stable go
// compiler recommended.
-func init() { Go_version_1_8_required_for_compilation() }
+func init() { Go_version_1_9_required_for_compilation() }
diff --git a/fstest/fstests/bits.go b/fstest/fstests/bits.go
deleted file mode 100644
index eb05a8e5e..000000000
--- a/fstest/fstests/bits.go
+++ /dev/null
@@ -1,33 +0,0 @@
-//+build !go1.9
-
-package fstests
-
-func leadingZeros64(x uint64) int {
- var n uint64 = 64
-
- if y := x >> 32; y != 0 {
- n = n - 32
- x = y
- }
- if y := x >> 16; y != 0 {
- n = n - 16
- x = y
- }
- if y := x >> 8; y != 0 {
- n = n - 8
- x = y
- }
- if y := x >> 4; y != 0 {
- n = n - 4
- x = y
- }
- if y := x >> 2; y != 0 {
- n = n - 2
- x = y
- }
- if y := x >> 1; y != 0 {
- return int(n - 2)
- }
-
- return int(n - x)
-}
diff --git a/fstest/fstests/bits_go1_9.go b/fstest/fstests/bits_go1_9.go
deleted file mode 100644
index 13407781f..000000000
--- a/fstest/fstests/bits_go1_9.go
+++ /dev/null
@@ -1,11 +0,0 @@
-//+build go1.9
-
-package fstests
-
-import (
- "math/bits"
-)
-
-func leadingZeros64(x uint64) int {
- return bits.LeadingZeros64(x)
-}
diff --git a/fstest/fstests/fstests.go b/fstest/fstests/fstests.go
index 95e4ddeb8..bdf20d40f 100644
--- a/fstest/fstests/fstests.go
+++ b/fstest/fstests/fstests.go
@@ -11,6 +11,7 @@ import (
"fmt"
"io"
"io/ioutil"
+ "math/bits"
"os"
"path"
"path/filepath"
@@ -72,7 +73,7 @@ type SetUploadCutoffer interface {
// NextPowerOfTwo returns the current or next bigger power of two.
// All values less or equal 0 will return 0
func NextPowerOfTwo(i fs.SizeSuffix) fs.SizeSuffix {
- return 1 << uint(64-leadingZeros64(uint64(i)-1))
+ return 1 << uint(64-bits.LeadingZeros64(uint64(i)-1))
}
// NextMultipleOf returns a function that can be used as a CeilChunkSize function.
diff --git a/lib/oauthutil/oauthutil.go b/lib/oauthutil/oauthutil.go
index c6fb2b817..bfc58d8f7 100644
--- a/lib/oauthutil/oauthutil.go
+++ b/lib/oauthutil/oauthutil.go
@@ -590,3 +590,15 @@ func (s *authServer) Start() {
err = s.server.Serve(s.listener)
fs.Debugf(nil, "Closed auth server with error: %v", err)
}
+
+func (s *authServer) Stop() {
+ fs.Debugf(nil, "Closing auth server")
+ if s.code != nil {
+ close(s.code)
+ s.code = nil
+ }
+ _ = s.listener.Close()
+
+ // close the server
+ _ = s.server.Close()
+}
diff --git a/lib/oauthutil/oauthutil_new.go b/lib/oauthutil/oauthutil_new.go
deleted file mode 100644
index 9b9acbc00..000000000
--- a/lib/oauthutil/oauthutil_new.go
+++ /dev/null
@@ -1,19 +0,0 @@
-// oauthutil parts go1.8+
-
-//+build go1.8
-
-package oauthutil
-
-import "github.com/ncw/rclone/fs"
-
-func (s *authServer) Stop() {
- fs.Debugf(nil, "Closing auth server")
- if s.code != nil {
- close(s.code)
- s.code = nil
- }
- _ = s.listener.Close()
-
- // close the server
- _ = s.server.Close()
-}
diff --git a/lib/oauthutil/oauthutil_old.go b/lib/oauthutil/oauthutil_old.go
deleted file mode 100644
index d1a9e45e7..000000000
--- a/lib/oauthutil/oauthutil_old.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// oauthutil parts pre go1.8+
-
-//+build !go1.8
-
-package oauthutil
-
-import "github.com/ncw/rclone/fs"
-
-func (s *authServer) Stop() {
- fs.Debugf(nil, "Closing auth server")
- if s.code != nil {
- close(s.code)
- s.code = nil
- }
- _ = s.listener.Close()
-}
diff --git a/vfs/errors.go b/vfs/errors.go
index 564671a43..f5775af10 100644
--- a/vfs/errors.go
+++ b/vfs/errors.go
@@ -24,11 +24,11 @@ const (
// Errors which have exact counterparts in os
var (
- ENOENT = os.ErrNotExist
- EEXIST = os.ErrExist
- EPERM = os.ErrPermission
- EINVAL = os.ErrInvalid
- // ECLOSED see errors_{old,new}.go
+ ENOENT = os.ErrNotExist
+ EEXIST = os.ErrExist
+ EPERM = os.ErrPermission
+ EINVAL = os.ErrInvalid
+ ECLOSED = os.ErrClosed
)
var errorNames = []string{
diff --git a/vfs/errors_new.go b/vfs/errors_new.go
deleted file mode 100644
index 66e2671ff..000000000
--- a/vfs/errors_new.go
+++ /dev/null
@@ -1,10 +0,0 @@
-// Errors for go1.8+
-
-//+build go1.8
-
-package vfs
-
-import "os"
-
-// ECLOSED is returned when a handle is closed twice
-var ECLOSED = os.ErrClosed
diff --git a/vfs/errors_old.go b/vfs/errors_old.go
deleted file mode 100644
index b098a8b80..000000000
--- a/vfs/errors_old.go
+++ /dev/null
@@ -1,10 +0,0 @@
-// Errors for pre go1.8
-
-//+build !go1.8
-
-package vfs
-
-import "errors"
-
-// ECLOSED is returned when a handle is closed twice
-var ECLOSED = errors.New("file already closed")