Signed-off-by: Stephen J Day <stephen.day@docker.com>
| ... | ... |
@@ -3,13 +3,11 @@ package node |
| 3 | 3 |
import ( |
| 4 | 4 |
"fmt" |
| 5 | 5 |
|
| 6 |
- "golang.org/x/net/context" |
|
| 7 |
- |
|
| 8 |
- "github.com/spf13/cobra" |
|
| 9 |
- |
|
| 10 | 6 |
"github.com/docker/docker/api/client" |
| 11 | 7 |
"github.com/docker/docker/cli" |
| 12 | 8 |
apiclient "github.com/docker/engine-api/client" |
| 9 |
+ "github.com/spf13/cobra" |
|
| 10 |
+ "golang.org/x/net/context" |
|
| 13 | 11 |
) |
| 14 | 12 |
|
| 15 | 13 |
// NewNodeCommand returns a cobra command for `node` subcommands |
| ... | ... |
@@ -37,7 +35,7 @@ func NewNodeCommand(dockerCli *client.DockerCli) *cobra.Command {
|
| 37 | 37 |
// Reference returns the reference of a node. The special value "self" for a node |
| 38 | 38 |
// reference is mapped to the current node, hence the node ID is retrieved using |
| 39 | 39 |
// the `/info` endpoint. |
| 40 |
-func Reference(client apiclient.APIClient, ctx context.Context, ref string) (string, error) {
|
|
| 40 |
+func Reference(ctx context.Context, client apiclient.APIClient, ref string) (string, error) {
|
|
| 41 | 41 |
if ref == "self" {
|
| 42 | 42 |
info, err := client.Info(ctx) |
| 43 | 43 |
if err != nil {
|
| ... | ... |
@@ -45,7 +45,7 @@ func runInspect(dockerCli *client.DockerCli, opts inspectOptions) error {
|
| 45 | 45 |
client := dockerCli.Client() |
| 46 | 46 |
ctx := context.Background() |
| 47 | 47 |
getRef := func(ref string) (interface{}, []byte, error) {
|
| 48 |
- nodeRef, err := Reference(client, ctx, ref) |
|
| 48 |
+ nodeRef, err := Reference(ctx, client, ref) |
|
| 49 | 49 |
if err != nil {
|
| 50 | 50 |
return nil, nil, err |
| 51 | 51 |
} |
| ... | ... |
@@ -1,8 +1,6 @@ |
| 1 | 1 |
package node |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
- "golang.org/x/net/context" |
|
| 5 |
- |
|
| 6 | 4 |
"github.com/docker/docker/api/client" |
| 7 | 5 |
"github.com/docker/docker/api/client/idresolver" |
| 8 | 6 |
"github.com/docker/docker/api/client/task" |
| ... | ... |
@@ -10,6 +8,7 @@ import ( |
| 10 | 10 |
"github.com/docker/docker/opts" |
| 11 | 11 |
"github.com/docker/engine-api/types" |
| 12 | 12 |
"github.com/spf13/cobra" |
| 13 |
+ "golang.org/x/net/context" |
|
| 13 | 14 |
) |
| 14 | 15 |
|
| 15 | 16 |
type psOptions struct {
|
| ... | ... |
@@ -48,7 +47,7 @@ func runPs(dockerCli *client.DockerCli, opts psOptions) error {
|
| 48 | 48 |
client := dockerCli.Client() |
| 49 | 49 |
ctx := context.Background() |
| 50 | 50 |
|
| 51 |
- nodeRef, err := Reference(client, ctx, opts.nodeID) |
|
| 51 |
+ nodeRef, err := Reference(ctx, client, opts.nodeID) |
|
| 52 | 52 |
if err != nil {
|
| 53 | 53 |
return nil |
| 54 | 54 |
} |
| ... | ... |
@@ -1,8 +1,6 @@ |
| 1 | 1 |
package service |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
- "golang.org/x/net/context" |
|
| 5 |
- |
|
| 6 | 4 |
"github.com/docker/docker/api/client" |
| 7 | 5 |
"github.com/docker/docker/api/client/idresolver" |
| 8 | 6 |
"github.com/docker/docker/api/client/node" |
| ... | ... |
@@ -11,6 +9,7 @@ import ( |
| 11 | 11 |
"github.com/docker/docker/opts" |
| 12 | 12 |
"github.com/docker/engine-api/types" |
| 13 | 13 |
"github.com/spf13/cobra" |
| 14 |
+ "golang.org/x/net/context" |
|
| 14 | 15 |
) |
| 15 | 16 |
|
| 16 | 17 |
type psOptions struct {
|
| ... | ... |
@@ -54,7 +53,7 @@ func runPS(dockerCli *client.DockerCli, opts psOptions) error {
|
| 54 | 54 |
if filter.Include("node") {
|
| 55 | 55 |
nodeFilters := filter.Get("node")
|
| 56 | 56 |
for _, nodeFilter := range nodeFilters {
|
| 57 |
- nodeReference, err := node.Reference(client, ctx, nodeFilter) |
|
| 57 |
+ nodeReference, err := node.Reference(ctx, client, nodeFilter) |
|
| 58 | 58 |
if err != nil {
|
| 59 | 59 |
return err |
| 60 | 60 |
} |