The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/5938
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
From ff5e906e291da415781c0b7063174a53949e50a5 Mon Sep 17 00:00:00 2001 From: Thomas Parrott <thomas.parr...@canonical.com> Date: Thu, 11 Jul 2019 15:03:06 +0100 Subject: [PATCH] various: Removes use of golang.org/x/net/context in place of stdlib context Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com> --- lxd/backup.go | 2 +- lxd/cluster/events.go | 2 +- lxd/cluster/gateway.go | 2 +- lxd/cluster/gateway_test.go | 2 +- lxd/cluster/heartbeat.go | 2 +- lxd/cluster/heartbeat_test.go | 2 +- lxd/cluster/migrate_test.go | 2 +- lxd/cluster/upgrade.go | 2 +- lxd/cluster/upgrade_test.go | 2 +- lxd/container.go | 2 +- lxd/container_instance_types.go | 2 +- lxd/daemon.go | 2 +- lxd/images.go | 3 ++- lxd/logging.go | 2 +- lxd/networks_utils.go | 3 ++- lxd/task/func.go | 2 +- lxd/task/group.go | 3 +-- lxd/task/group_test.go | 2 +- lxd/task/task.go | 3 +-- lxd/task/task_test.go | 2 +- lxd/util/http.go | 2 +- test/macaroon-identity/auth.go | 3 +-- 22 files changed, 24 insertions(+), 25 deletions(-) diff --git a/lxd/backup.go b/lxd/backup.go index 4bd0aeb515..5bd1b77138 100644 --- a/lxd/backup.go +++ b/lxd/backup.go @@ -10,7 +10,7 @@ import ( "strings" "time" - "golang.org/x/net/context" + "context" "gopkg.in/yaml.v2" "github.com/lxc/lxd/lxd/cluster" diff --git a/lxd/cluster/events.go b/lxd/cluster/events.go index 29d49f2520..bbcef4c0a7 100644 --- a/lxd/cluster/events.go +++ b/lxd/cluster/events.go @@ -1,6 +1,7 @@ package cluster import ( + "context" "time" lxd "github.com/lxc/lxd/client" @@ -10,7 +11,6 @@ import ( "github.com/lxc/lxd/shared" "github.com/lxc/lxd/shared/api" "github.com/lxc/lxd/shared/logger" - "golang.org/x/net/context" ) // Events starts a task that continuously monitors the list of cluster nodes and diff --git a/lxd/cluster/gateway.go b/lxd/cluster/gateway.go index 7ec49e7e27..72484625ce 100644 --- a/lxd/cluster/gateway.go +++ b/lxd/cluster/gateway.go @@ -2,6 +2,7 @@ package cluster import ( "bufio" + "context" "crypto/tls" "fmt" "io" @@ -21,7 +22,6 @@ import ( "github.com/lxc/lxd/shared/eagain" "github.com/lxc/lxd/shared/logger" "github.com/pkg/errors" - "golang.org/x/net/context" ) // NewGateway creates a new Gateway for managing access to the dqlite cluster. diff --git a/lxd/cluster/gateway_test.go b/lxd/cluster/gateway_test.go index ebfc706a81..a7af5c1596 100644 --- a/lxd/cluster/gateway_test.go +++ b/lxd/cluster/gateway_test.go @@ -1,6 +1,7 @@ package cluster_test import ( + "context" "crypto/tls" "crypto/x509" "fmt" @@ -17,7 +18,6 @@ import ( "github.com/lxc/lxd/shared/logging" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "golang.org/x/net/context" ) // Basic creation and shutdown. By default, the gateway runs an in-memory gRPC diff --git a/lxd/cluster/heartbeat.go b/lxd/cluster/heartbeat.go index 4ca23fc7f8..82675baa30 100644 --- a/lxd/cluster/heartbeat.go +++ b/lxd/cluster/heartbeat.go @@ -2,6 +2,7 @@ package cluster import ( "bytes" + "context" "encoding/json" "fmt" "math/rand" @@ -14,7 +15,6 @@ import ( "github.com/lxc/lxd/shared" "github.com/lxc/lxd/shared/logger" "github.com/pkg/errors" - "golang.org/x/net/context" ) // Heartbeat returns a task function that performs leader-initiated heartbeat diff --git a/lxd/cluster/heartbeat_test.go b/lxd/cluster/heartbeat_test.go index 579eeefe6b..3eec6dad59 100644 --- a/lxd/cluster/heartbeat_test.go +++ b/lxd/cluster/heartbeat_test.go @@ -1,6 +1,7 @@ package cluster_test import ( + "context" "net/http" "net/http/httptest" "testing" @@ -14,7 +15,6 @@ import ( "github.com/lxc/lxd/shared/version" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "golang.org/x/net/context" ) // After a heartbeat request is completed, the leader updates the heartbeat diff --git a/lxd/cluster/migrate_test.go b/lxd/cluster/migrate_test.go index fe3ff4983e..4f205eb610 100644 --- a/lxd/cluster/migrate_test.go +++ b/lxd/cluster/migrate_test.go @@ -1,6 +1,7 @@ package cluster_test import ( + "context" "database/sql/driver" "io/ioutil" "net" @@ -12,7 +13,6 @@ import ( "github.com/lxc/lxd/shared" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "golang.org/x/net/context" ) // Test migrating legacy db data to the dqlite 1.0 format. diff --git a/lxd/cluster/upgrade.go b/lxd/cluster/upgrade.go index b489856529..c1123fd543 100644 --- a/lxd/cluster/upgrade.go +++ b/lxd/cluster/upgrade.go @@ -1,6 +1,7 @@ package cluster import ( + "context" "fmt" "net/http" "os" @@ -13,7 +14,6 @@ import ( "github.com/lxc/lxd/shared" "github.com/lxc/lxd/shared/logger" "github.com/pkg/errors" - "golang.org/x/net/context" ) // NotifyUpgradeCompleted sends a notification to all other nodes in the diff --git a/lxd/cluster/upgrade_test.go b/lxd/cluster/upgrade_test.go index 4d992694fd..215412d75e 100644 --- a/lxd/cluster/upgrade_test.go +++ b/lxd/cluster/upgrade_test.go @@ -1,6 +1,7 @@ package cluster_test import ( + "context" "fmt" "io/ioutil" "os" @@ -11,7 +12,6 @@ import ( "github.com/lxc/lxd/lxd/db" "github.com/lxc/lxd/lxd/state" "github.com/stretchr/testify/require" - "golang.org/x/net/context" ) // A node can unblock other nodes that were waiting for a cluster upgrade to diff --git a/lxd/container.go b/lxd/container.go index 4a729c46c3..71c176456b 100644 --- a/lxd/container.go +++ b/lxd/container.go @@ -1,6 +1,7 @@ package main import ( + "context" "fmt" "io" "os" @@ -11,7 +12,6 @@ import ( "time" "github.com/pkg/errors" - "golang.org/x/net/context" "gopkg.in/lxc/go-lxc.v2" "gopkg.in/robfig/cron.v2" diff --git a/lxd/container_instance_types.go b/lxd/container_instance_types.go index edc950ac32..93beb809e0 100644 --- a/lxd/container_instance_types.go +++ b/lxd/container_instance_types.go @@ -1,13 +1,13 @@ package main import ( + "context" "fmt" "io/ioutil" "net/http" "strconv" "strings" - "golang.org/x/net/context" "gopkg.in/yaml.v2" "github.com/lxc/lxd/lxd/db" diff --git a/lxd/daemon.go b/lxd/daemon.go index 1d82f168f9..b1e1fe84c3 100644 --- a/lxd/daemon.go +++ b/lxd/daemon.go @@ -2,6 +2,7 @@ package main import ( "bytes" + "context" "crypto/x509" "database/sql" "database/sql/driver" @@ -19,7 +20,6 @@ import ( dqlite "github.com/CanonicalLtd/go-dqlite" "github.com/gorilla/mux" "github.com/pkg/errors" - "golang.org/x/net/context" "golang.org/x/sys/unix" "gopkg.in/lxc/go-lxc.v2" diff --git a/lxd/images.go b/lxd/images.go index 8342a9e4d2..e34b85f83c 100644 --- a/lxd/images.go +++ b/lxd/images.go @@ -2,6 +2,7 @@ package main import ( "bytes" + "context" "crypto/sha256" "encoding/json" "fmt" @@ -21,7 +22,7 @@ import ( "github.com/gorilla/mux" "github.com/pkg/errors" - "golang.org/x/net/context" + "gopkg.in/yaml.v2" lxd "github.com/lxc/lxd/client" diff --git a/lxd/logging.go b/lxd/logging.go index ab244ad5ca..15b8ccf1f3 100644 --- a/lxd/logging.go +++ b/lxd/logging.go @@ -1,6 +1,7 @@ package main import ( + "context" "io/ioutil" "os" "time" @@ -10,7 +11,6 @@ import ( "github.com/lxc/lxd/lxd/task" "github.com/lxc/lxd/shared" "github.com/lxc/lxd/shared/logger" - "golang.org/x/net/context" log "github.com/lxc/lxd/shared/log15" ) diff --git a/lxd/networks_utils.go b/lxd/networks_utils.go index b4fa182a91..9502f761a4 100644 --- a/lxd/networks_utils.go +++ b/lxd/networks_utils.go @@ -3,6 +3,7 @@ package main import ( "bufio" "bytes" + "context" "encoding/binary" "encoding/hex" "fmt" @@ -23,7 +24,7 @@ import ( "github.com/google/gopacket" "github.com/google/gopacket/layers" "github.com/mdlayher/eui64" - "golang.org/x/net/context" + "golang.org/x/sys/unix" "github.com/lxc/lxd/lxd/db" diff --git a/lxd/task/func.go b/lxd/task/func.go index da8d7bec74..428c620885 100644 --- a/lxd/task/func.go +++ b/lxd/task/func.go @@ -1,7 +1,7 @@ package task import ( - "golang.org/x/net/context" + "context" ) // Func captures the signature of a function executable by a Task. diff --git a/lxd/task/group.go b/lxd/task/group.go index 2cb8de774a..5de9fc792a 100644 --- a/lxd/task/group.go +++ b/lxd/task/group.go @@ -1,13 +1,12 @@ package task import ( + "context" "fmt" "strconv" "strings" "sync" "time" - - "golang.org/x/net/context" ) // Group of tasks sharing the same lifecycle. diff --git a/lxd/task/group_test.go b/lxd/task/group_test.go index 3f93c7e2a3..a542b9b711 100644 --- a/lxd/task/group_test.go +++ b/lxd/task/group_test.go @@ -1,12 +1,12 @@ package task_test import ( + "context" "testing" "time" "github.com/lxc/lxd/lxd/task" "github.com/stretchr/testify/assert" - "golang.org/x/net/context" ) func TestGroup_Add(t *testing.T) { diff --git a/lxd/task/task.go b/lxd/task/task.go index 0c252a54ee..a2e8440a8d 100644 --- a/lxd/task/task.go +++ b/lxd/task/task.go @@ -1,9 +1,8 @@ package task import ( + "context" "time" - - "golang.org/x/net/context" ) // Task executes a certain function periodically, according to a certain diff --git a/lxd/task/task_test.go b/lxd/task/task_test.go index 3fe99d1bd8..5cceb8507e 100644 --- a/lxd/task/task_test.go +++ b/lxd/task/task_test.go @@ -1,13 +1,13 @@ package task_test import ( + "context" "fmt" "testing" "time" "github.com/lxc/lxd/lxd/task" "github.com/stretchr/testify/assert" - "golang.org/x/net/context" ) // The given task is executed immediately by the scheduler. diff --git a/lxd/util/http.go b/lxd/util/http.go index e1660c9b86..96674dd60a 100644 --- a/lxd/util/http.go +++ b/lxd/util/http.go @@ -2,6 +2,7 @@ package util import ( "bytes" + "context" "crypto/sha256" "crypto/x509" "encoding/json" @@ -16,7 +17,6 @@ import ( "strings" "time" - "golang.org/x/net/context" "golang.org/x/sys/unix" log "github.com/lxc/lxd/shared/log15" diff --git a/test/macaroon-identity/auth.go b/test/macaroon-identity/auth.go index 3711b86327..22e982acf7 100644 --- a/test/macaroon-identity/auth.go +++ b/test/macaroon-identity/auth.go @@ -1,13 +1,12 @@ package main import ( + "context" "encoding/base64" "fmt" "log" "net/http" - "golang.org/x/net/context" - "gopkg.in/macaroon-bakery.v2/bakery" "gopkg.in/macaroon-bakery.v2/bakery/checkers" "gopkg.in/macaroon-bakery.v2/httpbakery"
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel