Skip to content

Commit

Permalink
Switch from x/net/context to 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,
x/net/context merely provides some types aliased to those in
the standard context package.

The changes were performed by the following script:

for f in $(git ls-files \*.go | grep -v ^vendor/); do
	sed -i 's|golang.org/x/net/context|context|' $f
	goimports -w $f
	for i in 1 2; do
		awk '/^$/ {e=1; next;}
			/\t"context"$/ {e=0;}
			{if (e) {print ""; e=0}; print;}' < $f > $f.new && \
				mv $f.new $f
		goimports -w $f
	done
done

[v2: do awk/goimports fixup twice]
Signed-off-by: Kir Kolyshkin <[email protected]>
  • Loading branch information
kolyshkin committed May 11, 2018
1 parent 0ff5f52 commit 6f8070d
Show file tree
Hide file tree
Showing 171 changed files with 195 additions and 188 deletions.
3 changes: 2 additions & 1 deletion cli/command/checkpoint/client_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package checkpoint

import (
"context"

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

type fakeClient struct {
Expand Down
3 changes: 1 addition & 2 deletions cli/command/checkpoint/create.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package checkpoint

import (
"context"
"fmt"

"golang.org/x/net/context"

"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/docker/api/types"
Expand Down
2 changes: 1 addition & 1 deletion cli/command/checkpoint/list.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package checkpoint

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

"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
Expand Down
2 changes: 1 addition & 1 deletion cli/command/checkpoint/remove.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package checkpoint

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

"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
Expand Down
2 changes: 1 addition & 1 deletion cli/command/cli.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package command

import (
"context"
"io"
"net"
"net/http"
Expand Down Expand Up @@ -28,7 +29,6 @@ import (
"github.com/theupdateframework/notary"
notaryclient "github.com/theupdateframework/notary/client"
"github.com/theupdateframework/notary/passphrase"
"golang.org/x/net/context"
)

// Streams is an interface which exposes the standard input and output streams
Expand Down
2 changes: 1 addition & 1 deletion cli/command/cli_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package command

import (
"context"
"crypto/x509"
"os"
"runtime"
Expand All @@ -17,7 +18,6 @@ import (
"github.com/gotestyourself/gotestyourself/env"
"github.com/gotestyourself/gotestyourself/fs"
"github.com/pkg/errors"
"golang.org/x/net/context"
)

func TestNewAPIClientFromFlags(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion cli/command/config/client_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package config

import (
"context"

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

type fakeClient struct {
Expand Down
2 changes: 1 addition & 1 deletion cli/command/config/create.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package config

import (
"context"
"fmt"
"io"
"io/ioutil"
Expand All @@ -12,7 +13,6 @@ import (
"github.com/docker/docker/pkg/system"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"golang.org/x/net/context"
)

type createOptions struct {
Expand Down
2 changes: 1 addition & 1 deletion cli/command/config/inspect.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package config

import (
"context"
"fmt"
"strings"

"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/formatter"
"github.com/spf13/cobra"
"golang.org/x/net/context"
)

type inspectOptions struct {
Expand Down
2 changes: 1 addition & 1 deletion cli/command/config/ls.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package config

import (
"context"
"sort"

"github.com/docker/cli/cli"
Expand All @@ -10,7 +11,6 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/swarm"
"github.com/spf13/cobra"
"golang.org/x/net/context"
"vbom.ml/util/sortorder"
)

Expand Down
2 changes: 1 addition & 1 deletion cli/command/config/remove.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package config

import (
"context"
"fmt"
"strings"

"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"golang.org/x/net/context"
)

type removeOptions struct {
Expand Down
2 changes: 1 addition & 1 deletion cli/command/container/attach.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package container

import (
"context"
"fmt"
"io"
"net/http/httputil"
Expand All @@ -14,7 +15,6 @@ import (
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"golang.org/x/net/context"
)

type attachOptions struct {
Expand Down
2 changes: 1 addition & 1 deletion cli/command/container/client_test.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package container

import (
"context"
"io"

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/network"
"github.com/docker/docker/client"
"golang.org/x/net/context"
)

type fakeClient struct {
Expand Down
2 changes: 1 addition & 1 deletion cli/command/container/commit.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package container

import (
"context"
"fmt"

"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/opts"
"github.com/docker/docker/api/types"
"github.com/spf13/cobra"
"golang.org/x/net/context"
)

type commitOptions struct {
Expand Down
2 changes: 1 addition & 1 deletion cli/command/container/cp.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package container

import (
"context"
"io"
"os"
"path/filepath"
Expand All @@ -13,7 +14,6 @@ import (
"github.com/docker/docker/pkg/system"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"golang.org/x/net/context"
)

type copyOptions struct {
Expand Down
2 changes: 1 addition & 1 deletion cli/command/container/create.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package container

import (
"context"
"fmt"
"io"
"os"
Expand All @@ -17,7 +18,6 @@ import (
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"golang.org/x/net/context"
)

type createOptions struct {
Expand Down
3 changes: 2 additions & 1 deletion cli/command/container/diff.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package container

import (
"context"

"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/formatter"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"golang.org/x/net/context"
)

type diffOptions struct {
Expand Down
2 changes: 1 addition & 1 deletion cli/command/container/exec.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package container

import (
"context"
"fmt"
"io"

Expand All @@ -13,7 +14,6 @@ import (
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"golang.org/x/net/context"
)

type execOptions struct {
Expand Down
2 changes: 1 addition & 1 deletion cli/command/container/exec_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package container

import (
"context"
"io/ioutil"
"testing"

Expand All @@ -12,7 +13,6 @@ import (
"github.com/gotestyourself/gotestyourself/assert"
is "github.com/gotestyourself/gotestyourself/assert/cmp"
"github.com/pkg/errors"
"golang.org/x/net/context"
)

func withDefaultOpts(options execOptions) execOptions {
Expand Down
2 changes: 1 addition & 1 deletion cli/command/container/export.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package container

import (
"context"
"io"

"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"golang.org/x/net/context"
)

type exportOptions struct {
Expand Down
2 changes: 1 addition & 1 deletion cli/command/container/hijack.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package container

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

// The default escape key sequence: ctrl-p, ctrl-q
Expand Down
3 changes: 2 additions & 1 deletion cli/command/container/inspect.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package container

import (
"context"

"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/inspect"
"github.com/spf13/cobra"
"golang.org/x/net/context"
)

type inspectOptions struct {
Expand Down
2 changes: 1 addition & 1 deletion cli/command/container/kill.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package container

import (
"context"
"fmt"
"strings"

"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"golang.org/x/net/context"
)

type killOptions struct {
Expand Down
2 changes: 1 addition & 1 deletion cli/command/container/list.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package container

import (
"context"
"io/ioutil"

"github.com/docker/cli/cli"
Expand All @@ -10,7 +11,6 @@ import (
"github.com/docker/cli/templates"
"github.com/docker/docker/api/types"
"github.com/spf13/cobra"
"golang.org/x/net/context"
)

type psOptions struct {
Expand Down
2 changes: 1 addition & 1 deletion cli/command/container/logs.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package container

import (
"context"
"io"

"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/docker/api/types"
"github.com/docker/docker/pkg/stdcopy"
"github.com/spf13/cobra"
"golang.org/x/net/context"
)

type logsOptions struct {
Expand Down
2 changes: 1 addition & 1 deletion cli/command/container/pause.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package container

import (
"context"
"fmt"
"strings"

"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"golang.org/x/net/context"
)

type pauseOptions struct {
Expand Down
Loading

0 comments on commit 6f8070d

Please sign in to comment.