mirror of
https://github.com/moby/moby.git
synced 2026-08-02 22:26:52 +00:00
api/client/node: correct ordering in context argument
Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
@@ -3,13 +3,11 @@ package node
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/docker/docker/api/client"
|
||||
"github.com/docker/docker/cli"
|
||||
apiclient "github.com/docker/engine-api/client"
|
||||
"github.com/spf13/cobra"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// NewNodeCommand returns a cobra command for `node` subcommands
|
||||
@@ -37,7 +35,7 @@ func NewNodeCommand(dockerCli *client.DockerCli) *cobra.Command {
|
||||
// Reference returns the reference of a node. The special value "self" for a node
|
||||
// reference is mapped to the current node, hence the node ID is retrieved using
|
||||
// the `/info` endpoint.
|
||||
func Reference(client apiclient.APIClient, ctx context.Context, ref string) (string, error) {
|
||||
func Reference(ctx context.Context, client apiclient.APIClient, ref string) (string, error) {
|
||||
if ref == "self" {
|
||||
info, err := client.Info(ctx)
|
||||
if err != nil {
|
||||
|
||||
@@ -45,7 +45,7 @@ func runInspect(dockerCli *client.DockerCli, opts inspectOptions) error {
|
||||
client := dockerCli.Client()
|
||||
ctx := context.Background()
|
||||
getRef := func(ref string) (interface{}, []byte, error) {
|
||||
nodeRef, err := Reference(client, ctx, ref)
|
||||
nodeRef, err := Reference(ctx, client, ref)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package node
|
||||
|
||||
import (
|
||||
"golang.org/x/net/context"
|
||||
|
||||
"github.com/docker/docker/api/client"
|
||||
"github.com/docker/docker/api/client/idresolver"
|
||||
"github.com/docker/docker/api/client/task"
|
||||
@@ -10,6 +8,7 @@ import (
|
||||
"github.com/docker/docker/opts"
|
||||
"github.com/docker/engine-api/types"
|
||||
"github.com/spf13/cobra"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
type psOptions struct {
|
||||
@@ -48,7 +47,7 @@ func runPs(dockerCli *client.DockerCli, opts psOptions) error {
|
||||
client := dockerCli.Client()
|
||||
ctx := context.Background()
|
||||
|
||||
nodeRef, err := Reference(client, ctx, opts.nodeID)
|
||||
nodeRef, err := Reference(ctx, client, opts.nodeID)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user