Skip to content

Commit

Permalink
Switch from x/net/context -> context
Browse files Browse the repository at this point in the history
Since Go 1.7, context is a standard package. Since Go 1.9, everything
that is provided by "x/net/context" is a couple of type aliases to
types in "context".

Many vendored packages still use x/net/context, so vendor entry remains
for now.

Signed-off-by: Kir Kolyshkin <[email protected]>
  • Loading branch information
kolyshkin committed Apr 23, 2018
1 parent 5c233cf commit 7d62e40
Show file tree
Hide file tree
Showing 346 changed files with 369 additions and 426 deletions.
2 changes: 1 addition & 1 deletion api/server/backend/build/backend.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package build // import "github.com/docker/docker/api/server/backend/build"

import (
"context"
"fmt"

"github.com/docker/distribution/reference"
Expand All @@ -11,7 +12,6 @@ import (
"github.com/docker/docker/image"
"github.com/docker/docker/pkg/stringid"
"github.com/pkg/errors"
"golang.org/x/net/context"
)

// ImageComponent provides an interface for working with images
Expand Down
2 changes: 1 addition & 1 deletion api/server/httputils/httputils.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package httputils // import "github.com/docker/docker/api/server/httputils"

import (
"context"
"io"
"mime"
"net/http"
Expand All @@ -9,7 +10,6 @@ import (
"github.com/docker/docker/errdefs"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"golang.org/x/net/context"
)

type contextKey string
Expand Down
3 changes: 1 addition & 2 deletions api/server/httputils/write_log_stream.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package httputils // import "github.com/docker/docker/api/server/httputils"

import (
"context"
"fmt"
"io"
"net/url"
"sort"

"golang.org/x/net/context"

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/backend"
"github.com/docker/docker/pkg/ioutils"
Expand Down
2 changes: 1 addition & 1 deletion api/server/middleware/cors.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package middleware // import "github.com/docker/docker/api/server/middleware"

import (
"context"
"net/http"

"github.com/sirupsen/logrus"
"golang.org/x/net/context"
)

// CORSMiddleware injects CORS headers to each request
Expand Down
2 changes: 1 addition & 1 deletion api/server/middleware/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package middleware // import "github.com/docker/docker/api/server/middleware"

import (
"bufio"
"context"
"encoding/json"
"io"
"net/http"
Expand All @@ -10,7 +11,6 @@ import (
"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/pkg/ioutils"
"github.com/sirupsen/logrus"
"golang.org/x/net/context"
)

// DebugRequestMiddleware dumps the request to logger
Expand Down
3 changes: 1 addition & 2 deletions api/server/middleware/experimental.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package middleware // import "github.com/docker/docker/api/server/middleware"

import (
"context"
"net/http"

"golang.org/x/net/context"
)

// ExperimentalMiddleware is a the middleware in charge of adding the
Expand Down
3 changes: 1 addition & 2 deletions api/server/middleware/middleware.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package middleware // import "github.com/docker/docker/api/server/middleware"

import (
"context"
"net/http"

"golang.org/x/net/context"
)

// Middleware is an interface to allow the use of ordinary functions as Docker API filters.
Expand Down
2 changes: 1 addition & 1 deletion api/server/middleware/version.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package middleware // import "github.com/docker/docker/api/server/middleware"

import (
"context"
"fmt"
"net/http"
"runtime"

"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/types/versions"
"golang.org/x/net/context"
)

// VersionMiddleware is a middleware that
Expand Down
2 changes: 1 addition & 1 deletion api/server/middleware/version_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package middleware // import "github.com/docker/docker/api/server/middleware"

import (
"context"
"net/http"
"net/http/httptest"
"runtime"
Expand All @@ -9,7 +10,6 @@ import (
"github.com/docker/docker/api/server/httputils"
"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"golang.org/x/net/context"
)

func TestVersionMiddlewareVersion(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion api/server/router/build/backend.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package build // import "github.com/docker/docker/api/server/router/build"

import (
"context"

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/backend"
"golang.org/x/net/context"
)

// Backend abstracts an image builder whose only purpose is to build an image referenced by an imageID.
Expand Down
2 changes: 1 addition & 1 deletion api/server/router/build/build_routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package build // import "github.com/docker/docker/api/server/router/build"

import (
"bytes"
"context"
"encoding/base64"
"encoding/json"
"fmt"
Expand All @@ -25,7 +26,6 @@ import (
units "github.com/docker/go-units"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"golang.org/x/net/context"
)

type invalidIsolationError string
Expand Down
2 changes: 1 addition & 1 deletion api/server/router/checkpoint/checkpoint_routes.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package checkpoint // import "github.com/docker/docker/api/server/router/checkpoint"

import (
"context"
"encoding/json"
"net/http"

"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/types"
"golang.org/x/net/context"
)

func (s *checkpointRouter) postContainerCheckpoint(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
Expand Down
3 changes: 1 addition & 2 deletions api/server/router/container/backend.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package container // import "github.com/docker/docker/api/server/router/container"

import (
"context"
"io"

"golang.org/x/net/context"

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/backend"
"github.com/docker/docker/api/types/container"
Expand Down
2 changes: 1 addition & 1 deletion api/server/router/container/container_routes.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package container // import "github.com/docker/docker/api/server/router/container"

import (
"context"
"encoding/json"
"fmt"
"io"
Expand All @@ -20,7 +21,6 @@ import (
"github.com/docker/docker/pkg/signal"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"golang.org/x/net/context"
"golang.org/x/net/websocket"
)

Expand Down
2 changes: 1 addition & 1 deletion api/server/router/container/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package container // import "github.com/docker/docker/api/server/router/containe
import (
"compress/flate"
"compress/gzip"
"context"
"encoding/base64"
"encoding/json"
"io"
Expand All @@ -12,7 +13,6 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/versions"
gddohttputil "github.com/golang/gddo/httputil"
"golang.org/x/net/context"
)

type pathError struct{}
Expand Down
2 changes: 1 addition & 1 deletion api/server/router/container/exec.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package container // import "github.com/docker/docker/api/server/router/container"

import (
"context"
"encoding/json"
"fmt"
"io"
Expand All @@ -13,7 +14,6 @@ import (
"github.com/docker/docker/errdefs"
"github.com/docker/docker/pkg/stdcopy"
"github.com/sirupsen/logrus"
"golang.org/x/net/context"
)

func (s *containerRouter) getExecByID(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
Expand Down
2 changes: 1 addition & 1 deletion api/server/router/container/inspect.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package container // import "github.com/docker/docker/api/server/router/container"

import (
"context"
"net/http"

"github.com/docker/docker/api/server/httputils"
"golang.org/x/net/context"
)

// getContainersByName inspects container's configuration and serializes it as json.
Expand Down
2 changes: 1 addition & 1 deletion api/server/router/debug/debug.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package debug // import "github.com/docker/docker/api/server/router/debug"

import (
"context"
"expvar"
"net/http"
"net/http/pprof"

"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/server/router"
"golang.org/x/net/context"
)

// NewRouter creates a new debug router
Expand Down
3 changes: 1 addition & 2 deletions api/server/router/debug/debug_routes.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package debug // import "github.com/docker/docker/api/server/router/debug"

import (
"context"
"net/http"
"net/http/pprof"

"golang.org/x/net/context"
)

func handlePprof(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
Expand Down
3 changes: 2 additions & 1 deletion api/server/router/distribution/backend.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package distribution // import "github.com/docker/docker/api/server/router/distribution"

import (
"context"

"github.com/docker/distribution"
"github.com/docker/distribution/reference"
"github.com/docker/docker/api/types"
"golang.org/x/net/context"
)

// Backend is all the methods that need to be implemented
Expand Down
2 changes: 1 addition & 1 deletion api/server/router/distribution/distribution_routes.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package distribution // import "github.com/docker/docker/api/server/router/distribution"

import (
"context"
"encoding/base64"
"encoding/json"
"net/http"
Expand All @@ -15,7 +16,6 @@ import (
registrytypes "github.com/docker/docker/api/types/registry"
"github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"
"golang.org/x/net/context"
)

func (s *distributionRouter) getDistributionInfo(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
Expand Down
3 changes: 1 addition & 2 deletions api/server/router/experimental.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package router // import "github.com/docker/docker/api/server/router"

import (
"context"
"net/http"

"golang.org/x/net/context"

"github.com/docker/docker/api/server/httputils"
)

Expand Down
2 changes: 1 addition & 1 deletion api/server/router/image/backend.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package image // import "github.com/docker/docker/api/server/router/image"

import (
"context"
"io"

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/image"
"github.com/docker/docker/api/types/registry"
"golang.org/x/net/context"
)

// Backend is all the methods that need to be implemented
Expand Down
2 changes: 1 addition & 1 deletion api/server/router/image/image_routes.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package image // import "github.com/docker/docker/api/server/router/image"

import (
"context"
"encoding/base64"
"encoding/json"
"fmt"
Expand All @@ -19,7 +20,6 @@ import (
"github.com/docker/docker/registry"
specs "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"
"golang.org/x/net/context"
)

// Creates an image from Pull or from Import
Expand Down
2 changes: 1 addition & 1 deletion api/server/router/local.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package router // import "github.com/docker/docker/api/server/router"

import (
"context"
"net/http"

"github.com/docker/docker/api/server/httputils"
"golang.org/x/net/context"
)

// RouteWrapper wraps a route with extra functionality.
Expand Down
2 changes: 1 addition & 1 deletion api/server/router/network/backend.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package network // import "github.com/docker/docker/api/server/router/network"

import (
"golang.org/x/net/context"
"context"

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/filters"
Expand Down
3 changes: 1 addition & 2 deletions api/server/router/network/network_routes.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package network // import "github.com/docker/docker/api/server/router/network"

import (
"context"
"encoding/json"
"net/http"
"strconv"
"strings"

"golang.org/x/net/context"

"github.com/docker/docker/api/server/httputils"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/filters"
Expand Down
2 changes: 1 addition & 1 deletion api/server/router/plugin/backend.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package plugin // import "github.com/docker/docker/api/server/router/plugin"

import (
"context"
"io"
"net/http"

"github.com/docker/distribution/reference"
enginetypes "github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/plugin"
"golang.org/x/net/context"
)

// Backend for Plugin
Expand Down
Loading

0 comments on commit 7d62e40

Please sign in to comment.