api/client/node: correct ordering in context argument

Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
Stephen J Day 2016-09-06 17:04:43 -07:00
parent 331e724e87
commit 084ff6dc6d
No known key found for this signature in database
GPG Key ID: FB5F6B2905D7ECF3
4 changed files with 8 additions and 12 deletions

View File

@ -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 {

View File

@ -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
}

View File

@ -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
}

View File

@ -1,8 +1,6 @@
package service
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/node"
@ -11,6 +9,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 {
@ -54,7 +53,7 @@ func runPS(dockerCli *client.DockerCli, opts psOptions) error {
if filter.Include("node") {
nodeFilters := filter.Get("node")
for _, nodeFilter := range nodeFilters {
nodeReference, err := node.Reference(client, ctx, nodeFilter)
nodeReference, err := node.Reference(ctx, client, nodeFilter)
if err != nil {
return err
}