From 02c59428432d2b570f1bf0b824875254acd680ae Mon Sep 17 00:00:00 2001 From: Marius Date: Tue, 11 Jun 2019 16:16:02 +0200 Subject: [PATCH] core: Use context package from Go stdlib --- config.go | 2 +- datastore.go | 3 +-- gcsstore/gcsservice.go | 5 ++--- gcsstore/gcsservice_test.go | 2 +- gcsstore/gcsstore.go | 3 +-- gcsstore/gcsstore_test.go | 3 +-- unrouted_handler.go | 3 +-- 7 files changed, 8 insertions(+), 13 deletions(-) diff --git a/config.go b/config.go index e72c6a8..5a7326a 100644 --- a/config.go +++ b/config.go @@ -47,7 +47,7 @@ type Config struct { func (config *Config) validate() error { if config.Logger == nil { - config.Logger = log.New(os.Stdout, "[tusd] ", log.Ldate | log.Ltime) + config.Logger = log.New(os.Stdout, "[tusd] ", log.Ldate|log.Ltime) } base := config.BasePath diff --git a/datastore.go b/datastore.go index 2030b89..079c367 100644 --- a/datastore.go +++ b/datastore.go @@ -1,9 +1,8 @@ package tusd import ( + "context" "io" - - "golang.org/x/net/context" ) type MetaData map[string]string diff --git a/gcsstore/gcsservice.go b/gcsstore/gcsservice.go index 7d3b8d5..2020acd 100644 --- a/gcsstore/gcsservice.go +++ b/gcsstore/gcsservice.go @@ -1,21 +1,20 @@ package gcsstore import ( + "context" "errors" "fmt" + "hash/crc32" "io" "math" "strconv" "strings" "cloud.google.com/go/storage" - "golang.org/x/net/context" "google.golang.org/api/googleapi" "google.golang.org/api/iterator" "google.golang.org/api/option" - "hash/crc32" - "github.com/vimeo/go-util/crc32combine" ) diff --git a/gcsstore/gcsservice_test.go b/gcsstore/gcsservice_test.go index 39388fe..23953f8 100644 --- a/gcsstore/gcsservice_test.go +++ b/gcsstore/gcsservice_test.go @@ -2,7 +2,7 @@ package gcsstore_test import ( "bytes" - "golang.org/x/net/context" + "context" "testing" "gopkg.in/h2non/gock.v1" diff --git a/gcsstore/gcsstore.go b/gcsstore/gcsstore.go index cf2579e..78bf32e 100644 --- a/gcsstore/gcsstore.go +++ b/gcsstore/gcsstore.go @@ -12,6 +12,7 @@ package gcsstore import ( "bytes" + "context" "encoding/json" "fmt" "io" @@ -20,8 +21,6 @@ import ( "sync" "sync/atomic" - "golang.org/x/net/context" - "cloud.google.com/go/storage" "github.com/tus/tusd" "github.com/tus/tusd/uid" diff --git a/gcsstore/gcsstore_test.go b/gcsstore/gcsstore_test.go index 7ab0101..8187fd0 100644 --- a/gcsstore/gcsstore_test.go +++ b/gcsstore/gcsstore_test.go @@ -2,12 +2,11 @@ package gcsstore_test import ( "bytes" + "context" "encoding/json" "fmt" "testing" - "golang.org/x/net/context" - "cloud.google.com/go/storage" "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" diff --git a/unrouted_handler.go b/unrouted_handler.go index 1c39841..e14f132 100644 --- a/unrouted_handler.go +++ b/unrouted_handler.go @@ -1,6 +1,7 @@ package tusd import ( + "context" "encoding/base64" "errors" "io" @@ -14,8 +15,6 @@ import ( "strings" "sync/atomic" "time" - - "golang.org/x/net/context" ) const UploadLengthDeferred = "1"