1
0
mirror of https://github.com/golang/go synced 2024-11-19 12:14:42 -07:00

net/http, math/big, cmd/internal/gc/big: replaced errors.New(fmt.Sprintf(...)) in favour fmt.Errorf()

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>
This commit is contained in:
Igor Dolzhikov 2015-04-05 22:32:52 +06:00 committed by Brad Fitzpatrick
parent c264c87335
commit debe12cfcf
5 changed files with 5 additions and 7 deletions

View 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:])

View 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])

View 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:])

View 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])

View 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