deps: remove deprecated net/context (#13932)

The `golang.org/x/net/context` package was merged into the stdlib as of go
1.7. Update the imports to use the identical stdlib version. Clean up import
blocks for the impacted files to remove unnecessary package aliasing.
This commit is contained in:
Tim Gross
2022-07-28 14:46:56 -04:00
committed by GitHub
parent 5d8258ecab
commit ce14fc6e6b
10 changed files with 30 additions and 23 deletions

View File

@@ -1,9 +1,9 @@
package logmon
import (
"golang.org/x/net/context"
"context"
plugin "github.com/hashicorp/go-plugin"
"github.com/hashicorp/go-plugin"
"github.com/hashicorp/nomad/client/logmon/proto"
)

View File

@@ -1,6 +1,7 @@
package docklog
import (
"context"
"fmt"
"io"
"math/rand"
@@ -9,10 +10,10 @@ import (
"time"
docker "github.com/fsouza/go-dockerclient"
hclog "github.com/hashicorp/go-hclog"
multierror "github.com/hashicorp/go-multierror"
"github.com/hashicorp/go-hclog"
"github.com/hashicorp/go-multierror"
"github.com/hashicorp/nomad/client/lib/fifo"
"golang.org/x/net/context"
)
// DockerLogger is a small utility to forward logs from a docker container to a target

View File

@@ -2,6 +2,7 @@ package docklog
import (
"bytes"
"context"
"errors"
"fmt"
"runtime"
@@ -9,12 +10,12 @@ import (
"time"
docker "github.com/fsouza/go-dockerclient"
"github.com/stretchr/testify/require"
"github.com/hashicorp/nomad/ci"
ctu "github.com/hashicorp/nomad/client/testutil"
"github.com/hashicorp/nomad/helper/testlog"
"github.com/hashicorp/nomad/testutil"
"github.com/stretchr/testify/require"
"golang.org/x/net/context"
)
func testContainerDetails() (image string, imageName string, imageTag string) {

View File

@@ -1,9 +1,10 @@
package docklog
import (
"golang.org/x/net/context"
"context"
"github.com/hashicorp/go-plugin"
plugin "github.com/hashicorp/go-plugin"
"github.com/hashicorp/nomad/drivers/docker/docklog/proto"
)

View File

@@ -1,6 +1,7 @@
package docker
import (
"context"
"fmt"
"os"
"runtime"
@@ -12,12 +13,12 @@ import (
"github.com/armon/circbuf"
docker "github.com/fsouza/go-dockerclient"
"github.com/hashicorp/consul-template/signals"
hclog "github.com/hashicorp/go-hclog"
plugin "github.com/hashicorp/go-plugin"
"github.com/hashicorp/go-hclog"
"github.com/hashicorp/go-plugin"
"github.com/hashicorp/nomad/drivers/docker/docklog"
"github.com/hashicorp/nomad/plugins/drivers"
pstructs "github.com/hashicorp/nomad/plugins/shared/structs"
"golang.org/x/net/context"
)
type taskHandle struct {

View File

@@ -1,18 +1,19 @@
package executor
import (
"context"
"fmt"
"syscall"
"time"
"github.com/golang/protobuf/ptypes"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"github.com/hashicorp/nomad/drivers/shared/executor/proto"
"github.com/hashicorp/nomad/nomad/structs"
"github.com/hashicorp/nomad/plugins/drivers"
sproto "github.com/hashicorp/nomad/plugins/shared/structs/proto"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
type grpcExecutorServer struct {

2
go.mod
View File

@@ -120,7 +120,6 @@ require (
go.uber.org/goleak v1.1.12
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d
golang.org/x/exp v0.0.0-20220609121020-a51bd0440498
golang.org/x/net v0.0.0-20220225172249-27dd8689420f
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/sys v0.0.0-20220517195934-5e4e11fc645e
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65
@@ -264,6 +263,7 @@ require (
github.com/yusufpapurcu/wmi v1.2.2 // indirect
go.opencensus.io v0.23.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect

View File

@@ -1,11 +1,11 @@
package base
import (
"context"
"fmt"
plugin "github.com/hashicorp/go-plugin"
"github.com/hashicorp/nomad/plugins/base/proto"
"golang.org/x/net/context"
)
// basePluginServer wraps a base plugin and exposes it via gRPC.

View File

@@ -1,13 +1,14 @@
package device
import (
"context"
"fmt"
"time"
"github.com/golang/protobuf/ptypes"
plugin "github.com/hashicorp/go-plugin"
"github.com/hashicorp/go-plugin"
"github.com/hashicorp/nomad/plugins/device/proto"
context "golang.org/x/net/context"
)
// devicePluginServer wraps a device plugin and exposes it via gRPC.

View File

@@ -1,19 +1,20 @@
package drivers
import (
"context"
"fmt"
"io"
"math"
"github.com/golang/protobuf/ptypes"
plugin "github.com/hashicorp/go-plugin"
"github.com/hashicorp/go-plugin"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"github.com/hashicorp/nomad/nomad/structs"
"github.com/hashicorp/nomad/plugins/drivers/proto"
dstructs "github.com/hashicorp/nomad/plugins/shared/structs"
sproto "github.com/hashicorp/nomad/plugins/shared/structs/proto"
context "golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
type driverPluginServer struct {