gofix
diff --git a/diff.go b/diff.go
index 5d7778a..fdcd1eb 100644
--- a/diff.go
+++ b/diff.go
@@ -3,20 +3,16 @@
import (
"fmt"
"io"
- "os"
"reflect"
)
-
type sbuf []string
-
-func (s *sbuf) Write(b []byte) (int, os.Error) {
+func (s *sbuf) Write(b []byte) (int, error) {
*s = append(*s, string(b))
return len(b), nil
}
-
// Diff returns a slice where each element describes
// a difference between a and b.
func Diff(a, b interface{}) (desc []string) {
@@ -24,19 +20,16 @@
return desc
}
-
// Fdiff writes to w a description of the differences between a and b.
func Fdiff(w io.Writer, a, b interface{}) {
diffWriter{w: w}.diff(reflect.ValueOf(a), reflect.ValueOf(b))
}
-
type diffWriter struct {
w io.Writer
l string // label
}
-
func (w diffWriter) printf(f string, a ...interface{}) {
var l string
if w.l != "" {
@@ -45,7 +38,6 @@
fmt.Fprintf(w.w, l+f, a...)
}
-
func (w diffWriter) diff(av, bv reflect.Value) {
if !av.IsValid() && bv.IsValid() {
w.printf("nil != %#v", bv.Interface())
@@ -103,7 +95,6 @@
}
}
-
func (d diffWriter) relabel(name string) (d1 diffWriter) {
d1 = d
if d.l != "" {
diff --git a/pretty.go b/pretty.go
index 0362c79..84b69c4 100644
--- a/pretty.go
+++ b/pretty.go
@@ -19,37 +19,32 @@
import (
"fmt"
"io"
- "os"
)
-
// Errorf is a convenience wrapper for fmt.Errorf.
//
// Calling Errorf(f, x, y) is equivalent to
// fmt.Errorf(f, Formatter(x), Formatter(y)).
-func Errorf(format string, a ...interface{}) os.Error {
+func Errorf(format string, a ...interface{}) error {
return fmt.Errorf(format, wrap(a)...)
}
-
// Fprintf is a convenience wrapper for fmt.Fprintf.
//
// Calling Fprintf(w, f, x, y) is equivalent to
// fmt.Fprintf(w, f, Formatter(x), Formatter(y)).
-func Fprintf(w io.Writer, format string, a ...interface{}) (n int, error os.Error) {
+func Fprintf(w io.Writer, format string, a ...interface{}) (n int, error error) {
return fmt.Fprintf(w, format, wrap(a)...)
}
-
// Printf is a convenience wrapper for fmt.Printf.
//
// Calling Printf(f, x, y) is equivalent to
// fmt.Printf(f, Formatter(x), Formatter(y)).
-func Printf(format string, a ...interface{}) (n int, errno os.Error) {
+func Printf(format string, a ...interface{}) (n int, errno error) {
return fmt.Printf(format, wrap(a)...)
}
-
// Sprintf is a convenience wrapper for fmt.Sprintf.
//
// Calling Sprintf(f, x, y) is equivalent to
@@ -58,7 +53,6 @@
return fmt.Sprintf(format, wrap(a)...)
}
-
func wrap(a []interface{}) []interface{} {
w := make([]interface{}, len(a))
for i, x := range a {