瀏覽代碼

Change references to query values.

Signed-off-by: David Calavera <david.calavera@gmail.com>
David Calavera 9 年之前
父節點
當前提交
0b0431a856

+ 2 - 4
api/client/lib/container_create.go

@@ -12,10 +12,8 @@ import (
 // ContainerCreate creates a new container based in the given configuration.
 // It can be associated with a name, but it's not mandatory.
 func (cli *Client) ContainerCreate(config *runconfig.ContainerConfigWrapper, containerName string) (types.ContainerCreateResponse, error) {
-	var (
-		query    url.Values
-		response types.ContainerCreateResponse
-	)
+	var response types.ContainerCreateResponse
+	query := url.Values{}
 	if containerName != "" {
 		query.Set("name", containerName)
 	}

+ 1 - 1
api/client/lib/container_list.go

@@ -11,7 +11,7 @@ import (
 
 // ContainerList returns the list of containers in the docker host.
 func (cli *Client) ContainerList(options types.ContainerListOptions) ([]types.Container, error) {
-	var query url.Values
+	query := url.Values{}
 
 	if options.All {
 		query.Set("all", "1")

+ 1 - 1
api/client/lib/container_remove.go

@@ -8,7 +8,7 @@ import (
 
 // ContainerRemove kills and removes a container from the docker host.
 func (cli *Client) ContainerRemove(options types.ContainerRemoveOptions) error {
-	var query url.Values
+	query := url.Values{}
 	if options.RemoveVolumes {
 		query.Set("v", "1")
 	}

+ 1 - 1
api/client/lib/container_rename.go

@@ -4,7 +4,7 @@ import "net/url"
 
 // ContainerRename changes the name of a given container.
 func (cli *Client) ContainerRename(containerID, newContainerName string) error {
-	var query url.Values
+	query := url.Values{}
 	query.Set("name", newContainerName)
 	resp, err := cli.POST("/containers/"+containerID+"/rename", query, nil, nil)
 	ensureReaderClosed(resp)

+ 1 - 1
api/client/lib/container_restart.go

@@ -9,7 +9,7 @@ import (
 // It makes the daemon to wait for the container to be up again for
 // a specific amount of time, given the timeout.
 func (cli *Client) ContainerRestart(containerID string, timeout int) error {
-	var query url.Values
+	query := url.Values{}
 	query.Set("t", strconv.Itoa(timeout))
 	resp, err := cli.POST("/containers"+containerID+"/restart", query, nil, nil)
 	ensureReaderClosed(resp)

+ 1 - 1
api/client/lib/container_stop.go

@@ -8,7 +8,7 @@ import (
 // ContainerStop stops a container without terminating the process.
 // The process is blocked until the container stops or the timeout expires.
 func (cli *Client) ContainerStop(containerID string, timeout int) error {
-	var query url.Values
+	query := url.Values{}
 	query.Set("t", strconv.Itoa(timeout))
 	resp, err := cli.POST("/containers/"+containerID+"/stop", query, nil, nil)
 	ensureReaderClosed(resp)

+ 2 - 4
api/client/lib/container_top.go

@@ -10,10 +10,8 @@ import (
 
 // ContainerTop shows process information from within a container.
 func (cli *Client) ContainerTop(containerID string, arguments []string) (types.ContainerProcessList, error) {
-	var (
-		query    url.Values
-		response types.ContainerProcessList
-	)
+	var response types.ContainerProcessList
+	query := url.Values{}
 	if len(arguments) > 0 {
 		query.Set("ps_args", strings.Join(arguments, " "))
 	}

+ 2 - 2
api/client/lib/copy.go

@@ -15,7 +15,7 @@ import (
 
 // ContainerStatPath returns Stat information about a path inside the container filesystem.
 func (cli *Client) ContainerStatPath(containerID, path string) (types.ContainerPathStat, error) {
-	query := make(url.Values, 1)
+	query := url.Values{}
 	query.Set("path", filepath.ToSlash(path)) // Normalize the paths used in the API.
 
 	urlStr := fmt.Sprintf("/containers/%s/archive", containerID)
@@ -29,7 +29,7 @@ func (cli *Client) ContainerStatPath(containerID, path string) (types.ContainerP
 
 // CopyToContainer copies content into the container filesystem.
 func (cli *Client) CopyToContainer(options types.CopyToContainerOptions) error {
-	var query url.Values
+	query := url.Values{}
 	query.Set("path", filepath.ToSlash(options.Path)) // Normalize the paths used in the API.
 	// Do not allow for an existing directory to be overwritten by a non-directory and vice versa.
 	if !options.AllowOverwriteDirWithFile {

+ 1 - 1
api/client/lib/events.go

@@ -13,7 +13,7 @@ import (
 // Events returns a stream of events in the daemon in a ReadCloser.
 // It's up to the caller to close the stream.
 func (cli *Client) Events(options types.EventsOptions) (io.ReadCloser, error) {
-	var query url.Values
+	query := url.Values{}
 	ref := time.Now()
 
 	if options.Since != "" {

+ 1 - 1
api/client/lib/image_create.go

@@ -10,7 +10,7 @@ import (
 // ImageCreate creates a new image based in the parent options.
 // It returns the JSON content in the response body.
 func (cli *Client) ImageCreate(options types.ImageCreateOptions) (io.ReadCloser, error) {
-	var query url.Values
+	query := url.Values{}
 	query.Set("fromImage", options.Parent)
 	query.Set("tag", options.Tag)
 

+ 1 - 1
api/client/lib/image_import.go

@@ -10,7 +10,7 @@ import (
 // ImageImport creates a new image based in the source options.
 // It returns the JSON content in the response body.
 func (cli *Client) ImageImport(options types.ImageImportOptions) (io.ReadCloser, error) {
-	var query url.Values
+	query := url.Values{}
 	query.Set("fromSrc", options.SourceName)
 	query.Set("repo", options.RepositoryName)
 	query.Set("tag", options.Tag)

+ 2 - 5
api/client/lib/image_list.go

@@ -10,11 +10,8 @@ import (
 
 // ImageList returns a list of images in the docker host.
 func (cli *Client) ImageList(options types.ImageListOptions) ([]types.Image, error) {
-	var (
-		images []types.Image
-		query  url.Values
-	)
-
+	var images []types.Image
+	query := url.Values{}
 	if options.Filters.Len() > 0 {
 		filterJSON, err := filters.ToParam(options.Filters)
 		if err != nil {

+ 1 - 1
api/client/lib/image_remove.go

@@ -9,7 +9,7 @@ import (
 
 // ImageRemove removes an image from the docker host.
 func (cli *Client) ImageRemove(options types.ImageRemoveOptions) ([]types.ImageDelete, error) {
-	var query url.Values
+	query := url.Values{}
 
 	if options.Force {
 		query.Set("force", "1")

+ 1 - 1
api/client/lib/kill.go

@@ -4,7 +4,7 @@ import "net/url"
 
 // ContainerKill terminates the container process but does not remove the container from the docker host.
 func (cli *Client) ContainerKill(containerID, signal string) error {
-	var query url.Values
+	query := url.Values{}
 	query.Set("signal", signal)
 
 	resp, err := cli.POST("/containers/"+containerID+"/kill", query, nil, nil)

+ 1 - 1
api/client/lib/logs.go

@@ -12,7 +12,7 @@ import (
 // ContainerLogs returns the logs generated by a container in an io.ReadCloser.
 // It's up to the caller to close the stream.
 func (cli *Client) ContainerLogs(options types.ContainerLogsOptions) (io.ReadCloser, error) {
-	var query url.Values
+	query := url.Values{}
 	if options.ShowStdout {
 		query.Set("stdout", "1")
 	}

+ 1 - 1
api/client/lib/volume.go

@@ -11,7 +11,7 @@ import (
 // VolumeList returns the volumes configured in the docker host.
 func (cli *Client) VolumeList(filter filters.Args) (types.VolumesListResponse, error) {
 	var volumes types.VolumesListResponse
-	var query url.Values
+	query := url.Values{}
 
 	if filter.Len() > 0 {
 		filterJSON, err := filters.ToParam(filter)