client: use strconv instead of fmt.Sprintf()
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
145817a9cf
commit
07b2e4cb79
1 changed files with 5 additions and 5 deletions
|
@ -3,8 +3,8 @@ package client // import "github.com/docker/docker/client"
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"github.com/docker/docker/api/types/filters"
|
"github.com/docker/docker/api/types/filters"
|
||||||
|
@ -23,12 +23,12 @@ func (cli *Client) BuildCachePrune(ctx context.Context, opts types.BuildCachePru
|
||||||
if opts.All {
|
if opts.All {
|
||||||
query.Set("all", "1")
|
query.Set("all", "1")
|
||||||
}
|
}
|
||||||
query.Set("keep-storage", fmt.Sprintf("%d", opts.KeepStorage))
|
query.Set("keep-storage", strconv.Itoa(int(opts.KeepStorage)))
|
||||||
filters, err := filters.ToJSON(opts.Filters)
|
f, err := filters.ToJSON(opts.Filters)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "prune could not marshal filters option")
|
return nil, errors.Wrap(err, "prune could not marshal filters option")
|
||||||
}
|
}
|
||||||
query.Set("filters", filters)
|
query.Set("filters", f)
|
||||||
|
|
||||||
serverResp, err := cli.post(ctx, "/build/prune", query, nil, nil)
|
serverResp, err := cli.post(ctx, "/build/prune", query, nil, nil)
|
||||||
defer ensureReaderClosed(serverResp)
|
defer ensureReaderClosed(serverResp)
|
||||||
|
@ -38,7 +38,7 @@ func (cli *Client) BuildCachePrune(ctx context.Context, opts types.BuildCachePru
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := json.NewDecoder(serverResp.body).Decode(&report); err != nil {
|
if err := json.NewDecoder(serverResp.body).Decode(&report); err != nil {
|
||||||
return nil, fmt.Errorf("Error retrieving disk usage: %v", err)
|
return nil, errors.Wrap(err, "error retrieving disk usage")
|
||||||
}
|
}
|
||||||
|
|
||||||
return &report, nil
|
return &report, nil
|
||||||
|
|
Loading…
Reference in a new issue