From 80588a5a6bea6efaf37bdad4598c735f9975d221 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Fri, 6 Apr 2018 19:13:27 +0100 Subject: [PATCH] Replace "golang.org/x/net/context" with "context" for go1.7+ #2154 --- backend/cache/cache.go | 10 ++++------ backend/sftp/sftp.go | 2 +- cmd/mount/dir.go | 2 +- cmd/mount/file.go | 2 +- cmd/mount/fs.go | 2 +- cmd/mount/handle.go | 2 +- cmd/serve/webdav/webdav.go | 2 +- fs/accounting/token_bucket.go | 2 +- fs/fshttp/http.go | 2 +- fs/march/march.go | 2 +- fs/operations/operations.go | 2 +- fs/sync/sync.go | 2 +- lib/oauthutil/oauthutil.go | 2 +- vfs/cache.go | 2 +- vfs/cache_test.go | 2 +- vfs/vfs.go | 2 +- 16 files changed, 19 insertions(+), 21 deletions(-) diff --git a/backend/cache/cache.go b/backend/cache/cache.go index ffc998b1d..06cfcbf75 100644 --- a/backend/cache/cache.go +++ b/backend/cache/cache.go @@ -3,18 +3,17 @@ package cache import ( + "context" "fmt" "io" + "os" + "os/signal" "path" "path/filepath" "strings" "sync" - "time" - - "os" - - "os/signal" "syscall" + "time" "github.com/ncw/rclone/backend/crypt" "github.com/ncw/rclone/fs" @@ -26,7 +25,6 @@ import ( "github.com/ncw/rclone/fs/walk" "github.com/ncw/rclone/lib/atexit" "github.com/pkg/errors" - "golang.org/x/net/context" "golang.org/x/time/rate" ) diff --git a/backend/sftp/sftp.go b/backend/sftp/sftp.go index dc8384e3f..21f9bf1f7 100644 --- a/backend/sftp/sftp.go +++ b/backend/sftp/sftp.go @@ -5,6 +5,7 @@ package sftp import ( + "context" "fmt" "io" "io/ioutil" @@ -27,7 +28,6 @@ import ( "github.com/pkg/sftp" "github.com/xanzy/ssh-agent" "golang.org/x/crypto/ssh" - "golang.org/x/net/context" "golang.org/x/time/rate" ) diff --git a/cmd/mount/dir.go b/cmd/mount/dir.go index 3af77e069..51f26ca65 100644 --- a/cmd/mount/dir.go +++ b/cmd/mount/dir.go @@ -12,7 +12,7 @@ import ( "github.com/ncw/rclone/fs/log" "github.com/ncw/rclone/vfs" "github.com/pkg/errors" - "golang.org/x/net/context" + "golang.org/x/net/context" // switch to "context" when we stop supporting go1.8 ) // Dir represents a directory entry diff --git a/cmd/mount/file.go b/cmd/mount/file.go index 25f5625e0..36624518a 100644 --- a/cmd/mount/file.go +++ b/cmd/mount/file.go @@ -10,7 +10,7 @@ import ( "github.com/ncw/rclone/cmd/mountlib" "github.com/ncw/rclone/fs/log" "github.com/ncw/rclone/vfs" - "golang.org/x/net/context" + "golang.org/x/net/context" // switch to "context" when we stop supporting go1.8 ) // File represents a file diff --git a/cmd/mount/fs.go b/cmd/mount/fs.go index d8adb35b1..77d84b36f 100644 --- a/cmd/mount/fs.go +++ b/cmd/mount/fs.go @@ -14,7 +14,7 @@ import ( "github.com/ncw/rclone/vfs" "github.com/ncw/rclone/vfs/vfsflags" "github.com/pkg/errors" - "golang.org/x/net/context" + "golang.org/x/net/context" // switch to "context" when we stop supporting go1.8 ) // FS represents the top level filing system diff --git a/cmd/mount/handle.go b/cmd/mount/handle.go index c5c842729..f987033bf 100644 --- a/cmd/mount/handle.go +++ b/cmd/mount/handle.go @@ -9,7 +9,7 @@ import ( fusefs "bazil.org/fuse/fs" "github.com/ncw/rclone/fs/log" "github.com/ncw/rclone/vfs" - "golang.org/x/net/context" + "golang.org/x/net/context" // switch to "context" when we stop supporting go1.8 ) // FileHandle is an open for read file handle on a File diff --git a/cmd/serve/webdav/webdav.go b/cmd/serve/webdav/webdav.go index 7549125f7..0590e8f92 100644 --- a/cmd/serve/webdav/webdav.go +++ b/cmd/serve/webdav/webdav.go @@ -15,7 +15,7 @@ import ( "github.com/ncw/rclone/vfs" "github.com/ncw/rclone/vfs/vfsflags" "github.com/spf13/cobra" - "golang.org/x/net/context" + "golang.org/x/net/context" // switch to "context" when we stop supporting go1.8 "golang.org/x/net/webdav" ) diff --git a/fs/accounting/token_bucket.go b/fs/accounting/token_bucket.go index ac8382c09..9990d3d93 100644 --- a/fs/accounting/token_bucket.go +++ b/fs/accounting/token_bucket.go @@ -1,13 +1,13 @@ package accounting import ( + "context" "sync" "time" "github.com/ncw/rclone/fs" "github.com/ncw/rclone/fs/rc" "github.com/pkg/errors" - "golang.org/x/net/context" // switch to "context" when we stop supporting go1.6 "golang.org/x/time/rate" ) diff --git a/fs/fshttp/http.go b/fs/fshttp/http.go index d2ae3fda7..516a75165 100644 --- a/fs/fshttp/http.go +++ b/fs/fshttp/http.go @@ -3,6 +3,7 @@ package fshttp import ( "bytes" + "context" "crypto/tls" "net" "net/http" @@ -12,7 +13,6 @@ import ( "time" "github.com/ncw/rclone/fs" - "golang.org/x/net/context" // switch to "context" when we stop supporting go1.6 "golang.org/x/time/rate" ) diff --git a/fs/march/march.go b/fs/march/march.go index 2ab2974aa..981e220fb 100644 --- a/fs/march/march.go +++ b/fs/march/march.go @@ -2,6 +2,7 @@ package march import ( + "context" "path" "sort" "strings" @@ -11,7 +12,6 @@ import ( "github.com/ncw/rclone/fs/filter" "github.com/ncw/rclone/fs/list" "github.com/ncw/rclone/fs/walk" - "golang.org/x/net/context" "golang.org/x/text/unicode/norm" ) diff --git a/fs/operations/operations.go b/fs/operations/operations.go index fdba32ca0..06a6c55da 100644 --- a/fs/operations/operations.go +++ b/fs/operations/operations.go @@ -3,6 +3,7 @@ package operations import ( "bytes" + "context" "fmt" "io" "io/ioutil" @@ -26,7 +27,6 @@ import ( "github.com/ncw/rclone/lib/readers" "github.com/pkg/errors" "github.com/spf13/pflag" - "golang.org/x/net/context" ) // CheckHashes checks the two files to see if they have common diff --git a/fs/sync/sync.go b/fs/sync/sync.go index 405191f6e..8febf769d 100644 --- a/fs/sync/sync.go +++ b/fs/sync/sync.go @@ -2,6 +2,7 @@ package sync import ( + "context" "fmt" "sort" "sync" @@ -14,7 +15,6 @@ import ( "github.com/ncw/rclone/fs/march" "github.com/ncw/rclone/fs/operations" "github.com/pkg/errors" - "golang.org/x/net/context" ) type syncCopyMove struct { diff --git a/lib/oauthutil/oauthutil.go b/lib/oauthutil/oauthutil.go index 5febfe066..1c4d926c9 100644 --- a/lib/oauthutil/oauthutil.go +++ b/lib/oauthutil/oauthutil.go @@ -1,6 +1,7 @@ package oauthutil import ( + "context" "crypto/rand" "encoding/json" "fmt" @@ -16,7 +17,6 @@ import ( "github.com/ncw/rclone/fs/fshttp" "github.com/pkg/errors" "github.com/skratchdot/open-golang/open" - "golang.org/x/net/context" "golang.org/x/oauth2" ) diff --git a/vfs/cache.go b/vfs/cache.go index 3af3fd448..30b4f9289 100644 --- a/vfs/cache.go +++ b/vfs/cache.go @@ -3,6 +3,7 @@ package vfs import ( + "context" "fmt" "os" "path" @@ -17,7 +18,6 @@ import ( "github.com/ncw/rclone/fs" "github.com/ncw/rclone/fs/config" "github.com/pkg/errors" - "golang.org/x/net/context" ) // CacheMode controls the functionality of the cache diff --git a/vfs/cache_test.go b/vfs/cache_test.go index 1ed31300d..6db0d2599 100644 --- a/vfs/cache_test.go +++ b/vfs/cache_test.go @@ -1,6 +1,7 @@ package vfs import ( + "context" "fmt" "io/ioutil" "os" @@ -14,7 +15,6 @@ import ( "github.com/spf13/pflag" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "golang.org/x/net/context" // switch to "context" when we stop supporting go1.6 ) // Check CacheMode it satisfies the pflag interface diff --git a/vfs/vfs.go b/vfs/vfs.go index e3cac7063..52cb15e6b 100644 --- a/vfs/vfs.go +++ b/vfs/vfs.go @@ -19,6 +19,7 @@ package vfs import ( + "context" "fmt" "os" "path" @@ -28,7 +29,6 @@ import ( "github.com/ncw/rclone/fs" "github.com/ncw/rclone/fs/log" - "golang.org/x/net/context" // switch to "context" when we stop supporting go1.6 ) // DefaultOpt is the default values uses for Opt