]> Cypherpunks repositories - gostls13.git/commitdiff
net/http, math/big, cmd/internal/gc/big: replaced errors.New(fmt.Sprintf(...)) in...
authorIgor Dolzhikov <bluesriverz@gmail.com>
Sun, 5 Apr 2015 16:32:52 +0000 (22:32 +0600)
committerBrad Fitzpatrick <bradfitz@golang.org>
Mon, 6 Apr 2015 15:40:34 +0000 (15:40 +0000)
Change-Id: I38fc0ab84a374cb9be0234e40665d7cea0e76fc1
Reviewed-on: https://go-review.googlesource.com/8402
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/internal/gc/big/int.go
src/cmd/internal/gc/big/rat.go
src/math/big/int.go
src/math/big/rat.go
src/net/http/client.go

index 3410ec47295864a1ffe60b5601fed6b72c2a1d65..7b419bf688aa9adf2ee546f65b10f9081c6f6f7a 100644 (file)
@@ -7,7 +7,6 @@
 package big
 
 import (
-       "errors"
        "fmt"
        "io"
        "math/rand"
@@ -813,7 +812,7 @@ func (z *Int) GobDecode(buf []byte) error {
        }
        b := buf[0]
        if b>>1 != intGobVersion {
-               return errors.New(fmt.Sprintf("Int.GobDecode: encoding version %d not supported", b>>1))
+               return fmt.Errorf("Int.GobDecode: encoding version %d not supported", b>>1)
        }
        z.neg = b&1 != 0
        z.abs = z.abs.setBytes(buf[1:])
index 748796c8cad954b5747c39ee38630ca443cb06ae..fb16f18a964e7121dc3cb635887a6a8d37c3628b 100644 (file)
@@ -546,7 +546,7 @@ func (z *Rat) GobDecode(buf []byte) error {
        }
        b := buf[0]
        if b>>1 != ratGobVersion {
-               return errors.New(fmt.Sprintf("Rat.GobDecode: encoding version %d not supported", b>>1))
+               return fmt.Errorf("Rat.GobDecode: encoding version %d not supported", b>>1)
        }
        const j = 1 + 4
        i := j + binary.BigEndian.Uint32(buf[j-4:j])
index 3410ec47295864a1ffe60b5601fed6b72c2a1d65..7b419bf688aa9adf2ee546f65b10f9081c6f6f7a 100644 (file)
@@ -7,7 +7,6 @@
 package big
 
 import (
-       "errors"
        "fmt"
        "io"
        "math/rand"
@@ -813,7 +812,7 @@ func (z *Int) GobDecode(buf []byte) error {
        }
        b := buf[0]
        if b>>1 != intGobVersion {
-               return errors.New(fmt.Sprintf("Int.GobDecode: encoding version %d not supported", b>>1))
+               return fmt.Errorf("Int.GobDecode: encoding version %d not supported", b>>1)
        }
        z.neg = b&1 != 0
        z.abs = z.abs.setBytes(buf[1:])
index 748796c8cad954b5747c39ee38630ca443cb06ae..fb16f18a964e7121dc3cb635887a6a8d37c3628b 100644 (file)
@@ -546,7 +546,7 @@ func (z *Rat) GobDecode(buf []byte) error {
        }
        b := buf[0]
        if b>>1 != ratGobVersion {
-               return errors.New(fmt.Sprintf("Rat.GobDecode: encoding version %d not supported", b>>1))
+               return fmt.Errorf("Rat.GobDecode: encoding version %d not supported", b>>1)
        }
        const j = 1 + 4
        i := j + binary.BigEndian.Uint32(buf[j-4:j])
index 7341871036fc4280f6f03d7b303c1581dfb97a33..88d444eca2dea1b2e1be85e09ed213b0b935dcda 100644 (file)
@@ -390,7 +390,7 @@ func (c *Client) doFollowingRedirects(ireq *Request, shouldRedirect func(int) bo
                        }
                        resp.Body.Close()
                        if urlStr = resp.Header.Get("Location"); urlStr == "" {
-                               err = errors.New(fmt.Sprintf("%d response missing Location header", resp.StatusCode))
+                               err = fmt.Errorf("%d response missing Location header", resp.StatusCode)
                                break
                        }
                        base = req.URL