From a2df86d08eda0b7cc88becbbeb89d6c789db0448 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 26 Dec 2012 13:17:36 -0800 Subject: [PATCH] More workarounds for http://golang.org/issue/4589. These ones don't matter as much, though (just debug output) Change-Id: Ief8c49e0243e21feacf035e63dbe925bb417f716 --- pkg/client/client.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/client/client.go b/pkg/client/client.go index 1f498d0ce..c192a43cb 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -144,16 +144,16 @@ func (c *Client) SearchExistingFileSchema(wholeRef *blobref.BlobRef) (*blobref.B return nil, err } var buf bytes.Buffer - body := io.TeeReader(io.LimitReader(res.Body, 1 << 20), &buf) + body := io.TeeReader(io.LimitReader(res.Body, 1<<20), &buf) if res.StatusCode != 200 { - io.Copy(ioutil.Discard, body) + io.Copy(struct{ io.Writer }{ioutil.Discard}, body) // golang.org/issue/4589 return nil, fmt.Errorf("client: got status code %d from URL %s; body %s", res.StatusCode, url, buf.String()) } var ress struct { Files []*blobref.BlobRef `json:"files"` } if err := json.NewDecoder(body).Decode(&ress); err != nil { - io.Copy(ioutil.Discard, body) + io.Copy(struct{ io.Writer }{ioutil.Discard}, body) // golang.org/issue/4589 return nil, fmt.Errorf("client: error parsing JSON from URL %s: %v; body=%s", url, err, buf.String()) } if len(ress.Files) == 0 { @@ -178,7 +178,7 @@ func (c *Client) FileHasContents(f, wholeRef *blobref.BlobRef) bool { if c.downloadHelper == "" { return false } - req := c.newRequest("HEAD", c.downloadHelper + f.String() + "/?verifycontents=" + wholeRef.String()) + req := c.newRequest("HEAD", c.downloadHelper+f.String()+"/?verifycontents="+wholeRef.String()) res, err := c.httpClient.Do(req) if err != nil { log.Printf("download helper HEAD error: %v", err)