Fixed some formatting functions that were called with invalid number/type of arguments.

Change-Id: I261c6fb732a6cf1e54e01fa3e5388c39c6deb720
This commit is contained in:
tnt 2014-07-01 11:46:45 +02:00
parent 5bae132e66
commit 4ac9938c8b
11 changed files with 11 additions and 11 deletions

View File

@ -273,7 +273,7 @@ func (s *storage) ReceiveBlob(plainBR blob.Ref, source io.Reader) (sb blob.Sized
err = s.index.Set(plainBR.String(), meta)
if err != nil {
return sb, fmt.Errorf("encrypt: error updating index for encrypted %v (plaintext %v): %v", err)
return sb, fmt.Errorf("encrypt: error updating index for encrypted %v (plaintext %v): %v", encBR, plainBR, err)
}
return blob.SizedRef{plainBR, uint32(plainSize)}, nil

View File

@ -86,7 +86,7 @@ func (ds *DiskStorage) migrate3to2() error {
}
dst := ds.blobPath(br)
if fi, err := os.Stat(dst); !os.IsNotExist(err) {
return fmt.Errorf("Expected %s to not exist; got stat %v, %v", fi, err)
return fmt.Errorf("Expected %s to not exist; got stat %v, %v", dst, fi, err)
}
if err := os.Rename(path, dst); err != nil {
return err

View File

@ -150,7 +150,7 @@ func testSizedBlob(t *testing.T, r io.Reader, b1 blob.Ref, size int64) {
t.Fatalf("error reading from %s: %v", r, err)
}
if n != size {
t.Fatalf("read %d bytes from %s, metadata said %d!", n, size)
t.Fatalf("read %d bytes from %s, metadata said %d!", n, r, size)
}
b2 := blob.RefFromHash(h)
if b2 != b1 {

View File

@ -456,7 +456,7 @@ func (r *run) importTweet(parent *importer.Object, tweet tweetItem, viaAPI bool)
tried++
res, err := r.HTTPClient().Get(mediaURL)
if err != nil {
return false, fmt.Errorf("Error fetching %s for tweet %s : %v", mediaURL, url)
return false, fmt.Errorf("Error fetching %s for tweet %s : %v", mediaURL, url, err)
}
if res.StatusCode == http.StatusNotFound {
continue

View File

@ -42,7 +42,7 @@ func HasID3v1Tag(r types.SizeReaderAt) (bool, error) {
buf := make([]byte, len(id3v1Magic), len(id3v1Magic))
if _, err := r.ReadAt(buf, r.Size()-ID3v1TagLength); err != nil {
return false, fmt.Errorf("Failed to read ID3v1 data: ", err)
return false, fmt.Errorf("Failed to read ID3v1 data: %v", err)
}
if bytes.Equal(buf, id3v1Magic) {
return true, nil

View File

@ -31,7 +31,7 @@ type reqAndExpected struct {
func req(s string) *http.Request {
req, err := http.ReadRequest(bufio.NewReader(strings.NewReader(s)))
if err != nil {
panic(fmt.Sprintf("bad request in test: %q (error: %v)", req, err))
panic(fmt.Sprintf("bad request in test: %v (error: %v)", req, err))
}
return req
}

View File

@ -185,7 +185,7 @@ func ParseDeps(r io.Reader) (providedBy map[string]string, requires map[string][
}
providedBy[namespace] = jsfile
if _, ok := requires[namespace]; ok {
return nil, nil, fmt.Errorf("Name %v has two sets of dependencies")
return nil, nil, fmt.Errorf("Name %v has two sets of dependencies", namespace)
}
if required != nil {
requires[namespace] = required

View File

@ -55,7 +55,7 @@ func HostPortToIP(hostport string, ctx *net.TCPAddr) (hostaddr *net.TCPAddr, err
}
iport, err := strconv.Atoi(port)
if err != nil || iport < 0 || iport > 0xFFFF {
return nil, fmt.Errorf("invalid port %s", iport)
return nil, fmt.Errorf("invalid port %d", iport)
}
var addr net.IP
if ctx != nil && host == "localhost" {

View File

@ -106,7 +106,7 @@ func writeFileMapOld(bs blobserver.StatReceiver, file *Builder, r io.Reader) (bl
return blob.Ref{}, err
}
if want := (blob.SizedRef{br, uint32(n)}); sb != want {
return blob.Ref{}, fmt.Errorf("schema/filewriter: wrote %s, expect", sb, want)
return blob.Ref{}, fmt.Errorf("schema/filewriter: wrote %s, expect %s", sb, want)
}
}

View File

@ -45,7 +45,7 @@ func TestDoErr(t *testing.T) {
return nil, someErr
})
if err != someErr {
t.Errorf("Do error = %v; want someErr", err, someErr)
t.Errorf("Do error = %v; want someErr %v", err, someErr)
}
if v != nil {
t.Errorf("unexpected non-nil value %#v", v)

View File

@ -71,7 +71,7 @@ func (t *Time3339) UnmarshalJSON(b []byte) error {
return nil
}
if len(b) < 2 || b[0] != '"' || b[len(b)-1] != '"' {
return fmt.Errorf("types: failed to unmarshal non-string value %q as an RFC 3339 time")
return fmt.Errorf("types: failed to unmarshal non-string value %q as an RFC 3339 time", b)
}
s := string(b[1 : len(b)-1])
if s == "" {