Commit debe12cf authored by Igor Dolzhikov's avatar Igor Dolzhikov Committed by Brad Fitzpatrick

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

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/8402Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent c264c873
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
package big package big
import ( import (
"errors"
"fmt" "fmt"
"io" "io"
"math/rand" "math/rand"
...@@ -813,7 +812,7 @@ func (z *Int) GobDecode(buf []byte) error { ...@@ -813,7 +812,7 @@ func (z *Int) GobDecode(buf []byte) error {
} }
b := buf[0] b := buf[0]
if b>>1 != intGobVersion { 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.neg = b&1 != 0
z.abs = z.abs.setBytes(buf[1:]) z.abs = z.abs.setBytes(buf[1:])
......
...@@ -546,7 +546,7 @@ func (z *Rat) GobDecode(buf []byte) error { ...@@ -546,7 +546,7 @@ func (z *Rat) GobDecode(buf []byte) error {
} }
b := buf[0] b := buf[0]
if b>>1 != ratGobVersion { 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 const j = 1 + 4
i := j + binary.BigEndian.Uint32(buf[j-4:j]) i := j + binary.BigEndian.Uint32(buf[j-4:j])
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
package big package big
import ( import (
"errors"
"fmt" "fmt"
"io" "io"
"math/rand" "math/rand"
...@@ -813,7 +812,7 @@ func (z *Int) GobDecode(buf []byte) error { ...@@ -813,7 +812,7 @@ func (z *Int) GobDecode(buf []byte) error {
} }
b := buf[0] b := buf[0]
if b>>1 != intGobVersion { 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.neg = b&1 != 0
z.abs = z.abs.setBytes(buf[1:]) z.abs = z.abs.setBytes(buf[1:])
......
...@@ -546,7 +546,7 @@ func (z *Rat) GobDecode(buf []byte) error { ...@@ -546,7 +546,7 @@ func (z *Rat) GobDecode(buf []byte) error {
} }
b := buf[0] b := buf[0]
if b>>1 != ratGobVersion { 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 const j = 1 + 4
i := j + binary.BigEndian.Uint32(buf[j-4:j]) i := j + binary.BigEndian.Uint32(buf[j-4:j])
......
...@@ -390,7 +390,7 @@ func (c *Client) doFollowingRedirects(ireq *Request, shouldRedirect func(int) bo ...@@ -390,7 +390,7 @@ func (c *Client) doFollowingRedirects(ireq *Request, shouldRedirect func(int) bo
} }
resp.Body.Close() resp.Body.Close()
if urlStr = resp.Header.Get("Location"); urlStr == "" { 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 break
} }
base = req.URL base = req.URL
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment