From 2fd401c8f190f1fe43e51a7f726f6ed6119a1f96 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Sat, 3 Dec 2011 02:17:34 +0000 Subject: libgo: Update to weekly.2011-11-02. From-SVN: r181964 --- libgo/go/fmt/print.go | 27 +++++++++-------- libgo/go/fmt/scan.go | 77 ++++++++++++++++++++++++----------------------- libgo/go/fmt/scan_test.go | 48 ++++++++++++++--------------- 3 files changed, 77 insertions(+), 75 deletions(-) (limited to 'libgo/go/fmt') diff --git a/libgo/go/fmt/print.go b/libgo/go/fmt/print.go index 5e0237f..1345644 100644 --- a/libgo/go/fmt/print.go +++ b/libgo/go/fmt/print.go @@ -6,6 +6,7 @@ package fmt import ( "bytes" + "errors" "io" "os" "reflect" @@ -37,7 +38,7 @@ var ( // the flags and options for the operand's format specifier. type State interface { // Write is the function to call to emit formatted output to be printed. - Write(b []byte) (ret int, err os.Error) + Write(b []byte) (ret int, err error) // Width returns the value of the width option and whether it has been set. Width() (wid int, ok bool) // Precision returns the value of the precision option and whether it has been set. @@ -165,7 +166,7 @@ func (p *pp) add(c rune) { // Implement Write so we can call Fprintf on a pp (through State), for // recursive use in custom verbs. -func (p *pp) Write(b []byte) (ret int, err os.Error) { +func (p *pp) Write(b []byte) (ret int, err error) { return p.buf.Write(b) } @@ -173,7 +174,7 @@ func (p *pp) Write(b []byte) (ret int, err os.Error) { // Fprintf formats according to a format specifier and writes to w. // It returns the number of bytes written and any write error encountered. -func Fprintf(w io.Writer, format string, a ...interface{}) (n int, err os.Error) { +func Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) { p := newPrinter() p.doPrintf(format, a) n64, err := p.buf.WriteTo(w) @@ -183,7 +184,7 @@ func Fprintf(w io.Writer, format string, a ...interface{}) (n int, err os.Error) // Printf formats according to a format specifier and writes to standard output. // It returns the number of bytes written and any write error encountered. -func Printf(format string, a ...interface{}) (n int, err os.Error) { +func Printf(format string, a ...interface{}) (n int, err error) { return Fprintf(os.Stdout, format, a...) } @@ -197,9 +198,9 @@ func Sprintf(format string, a ...interface{}) string { } // Errorf formats according to a format specifier and returns the string -// as a value that satisfies os.Error. -func Errorf(format string, a ...interface{}) os.Error { - return os.NewError(Sprintf(format, a...)) +// as a value that satisfies error. +func Errorf(format string, a ...interface{}) error { + return errors.New(Sprintf(format, a...)) } // These routines do not take a format string @@ -207,7 +208,7 @@ func Errorf(format string, a ...interface{}) os.Error { // Fprint formats using the default formats for its operands and writes to w. // Spaces are added between operands when neither is a string. // It returns the number of bytes written and any write error encountered. -func Fprint(w io.Writer, a ...interface{}) (n int, err os.Error) { +func Fprint(w io.Writer, a ...interface{}) (n int, err error) { p := newPrinter() p.doPrint(a, false, false) n64, err := p.buf.WriteTo(w) @@ -218,7 +219,7 @@ func Fprint(w io.Writer, a ...interface{}) (n int, err os.Error) { // Print formats using the default formats for its operands and writes to standard output. // Spaces are added between operands when neither is a string. // It returns the number of bytes written and any write error encountered. -func Print(a ...interface{}) (n int, err os.Error) { +func Print(a ...interface{}) (n int, err error) { return Fprint(os.Stdout, a...) } @@ -239,7 +240,7 @@ func Sprint(a ...interface{}) string { // Fprintln formats using the default formats for its operands and writes to w. // Spaces are always added between operands and a newline is appended. // It returns the number of bytes written and any write error encountered. -func Fprintln(w io.Writer, a ...interface{}) (n int, err os.Error) { +func Fprintln(w io.Writer, a ...interface{}) (n int, err error) { p := newPrinter() p.doPrint(a, true, true) n64, err := p.buf.WriteTo(w) @@ -250,7 +251,7 @@ func Fprintln(w io.Writer, a ...interface{}) (n int, err os.Error) { // Println formats using the default formats for its operands and writes to standard output. // Spaces are always added between operands and a newline is appended. // It returns the number of bytes written and any write error encountered. -func Println(a ...interface{}) (n int, err os.Error) { +func Println(a ...interface{}) (n int, err error) { return Fprintln(os.Stdout, a...) } @@ -635,11 +636,11 @@ func (p *pp) handleMethods(verb rune, plus, goSyntax bool, depth int) (wasString // setting wasString and handled and deferring catchPanic // must happen before calling the method. switch v := p.field.(type) { - case os.Error: + case error: wasString = false handled = true defer p.catchPanic(p.field, verb) - p.printField(v.String(), verb, plus, false, depth) + p.printField(v.Error(), verb, plus, false, depth) return case Stringer: diff --git a/libgo/go/fmt/scan.go b/libgo/go/fmt/scan.go index eae952c..54a9fe2 100644 --- a/libgo/go/fmt/scan.go +++ b/libgo/go/fmt/scan.go @@ -6,6 +6,7 @@ package fmt import ( "bytes" + "errors" "io" "math" "os" @@ -21,7 +22,7 @@ import ( // a local buffer will be used to back up the input, but its contents // will be lost when Scan returns. type runeUnreader interface { - UnreadRune() os.Error + UnreadRune() error } // ScanState represents the scanner state passed to custom scanners. @@ -32,9 +33,9 @@ type ScanState interface { // If invoked during Scanln, Fscanln, or Sscanln, ReadRune() will // return EOF after returning the first '\n' or when reading beyond // the specified width. - ReadRune() (r rune, size int, err os.Error) + ReadRune() (r rune, size int, err error) // UnreadRune causes the next call to ReadRune to return the same rune. - UnreadRune() os.Error + UnreadRune() error // SkipSpace skips space in the input. Newlines are treated as space // unless the scan operation is Scanln, Fscanln or Sscanln, in which case // a newline is treated as EOF. @@ -47,14 +48,14 @@ type ScanState interface { // EOF. The returned slice points to shared data that may be overwritten // by the next call to Token, a call to a Scan function using the ScanState // as input, or when the calling Scan method returns. - Token(skipSpace bool, f func(rune) bool) (token []byte, err os.Error) + Token(skipSpace bool, f func(rune) bool) (token []byte, err error) // Width returns the value of the width option and whether it has been set. // The unit is Unicode code points. Width() (wid int, ok bool) // Because ReadRune is implemented by the interface, Read should never be // called by the scanning routines and a valid implementation of // ScanState may choose always to return an error from Read. - Read(buf []byte) (n int, err os.Error) + Read(buf []byte) (n int, err error) } // Scanner is implemented by any value that has a Scan method, which scans @@ -62,27 +63,27 @@ type ScanState interface { // receiver, which must be a pointer to be useful. The Scan method is called // for any argument to Scan, Scanf, or Scanln that implements it. type Scanner interface { - Scan(state ScanState, verb rune) os.Error + Scan(state ScanState, verb rune) error } // Scan scans text read from standard input, storing successive // space-separated values into successive arguments. Newlines count // as space. It returns the number of items successfully scanned. // If that is less than the number of arguments, err will report why. -func Scan(a ...interface{}) (n int, err os.Error) { +func Scan(a ...interface{}) (n int, err error) { return Fscan(os.Stdin, a...) } // Scanln is similar to Scan, but stops scanning at a newline and // after the final item there must be a newline or EOF. -func Scanln(a ...interface{}) (n int, err os.Error) { +func Scanln(a ...interface{}) (n int, err error) { return Fscanln(os.Stdin, a...) } // Scanf scans text read from standard input, storing successive // space-separated values into successive arguments as determined by // the format. It returns the number of items successfully scanned. -func Scanf(format string, a ...interface{}) (n int, err os.Error) { +func Scanf(format string, a ...interface{}) (n int, err error) { return Fscanf(os.Stdin, format, a...) } @@ -90,20 +91,20 @@ func Scanf(format string, a ...interface{}) (n int, err os.Error) { // values into successive arguments. Newlines count as space. It // returns the number of items successfully scanned. If that is less // than the number of arguments, err will report why. -func Sscan(str string, a ...interface{}) (n int, err os.Error) { +func Sscan(str string, a ...interface{}) (n int, err error) { return Fscan(strings.NewReader(str), a...) } // Sscanln is similar to Sscan, but stops scanning at a newline and // after the final item there must be a newline or EOF. -func Sscanln(str string, a ...interface{}) (n int, err os.Error) { +func Sscanln(str string, a ...interface{}) (n int, err error) { return Fscanln(strings.NewReader(str), a...) } // Sscanf scans the argument string, storing successive space-separated // values into successive arguments as determined by the format. It // returns the number of items successfully parsed. -func Sscanf(str string, format string, a ...interface{}) (n int, err os.Error) { +func Sscanf(str string, format string, a ...interface{}) (n int, err error) { return Fscanf(strings.NewReader(str), format, a...) } @@ -111,7 +112,7 @@ func Sscanf(str string, format string, a ...interface{}) (n int, err os.Error) { // values into successive arguments. Newlines count as space. It // returns the number of items successfully scanned. If that is less // than the number of arguments, err will report why. -func Fscan(r io.Reader, a ...interface{}) (n int, err os.Error) { +func Fscan(r io.Reader, a ...interface{}) (n int, err error) { s, old := newScanState(r, true, false) n, err = s.doScan(a) s.free(old) @@ -120,7 +121,7 @@ func Fscan(r io.Reader, a ...interface{}) (n int, err os.Error) { // Fscanln is similar to Fscan, but stops scanning at a newline and // after the final item there must be a newline or EOF. -func Fscanln(r io.Reader, a ...interface{}) (n int, err os.Error) { +func Fscanln(r io.Reader, a ...interface{}) (n int, err error) { s, old := newScanState(r, false, true) n, err = s.doScan(a) s.free(old) @@ -130,7 +131,7 @@ func Fscanln(r io.Reader, a ...interface{}) (n int, err os.Error) { // Fscanf scans text read from r, storing successive space-separated // values into successive arguments as determined by the format. It // returns the number of items successfully parsed. -func Fscanf(r io.Reader, format string, a ...interface{}) (n int, err os.Error) { +func Fscanf(r io.Reader, format string, a ...interface{}) (n int, err error) { s, old := newScanState(r, false, false) n, err = s.doScanf(format, a) s.free(old) @@ -140,7 +141,7 @@ func Fscanf(r io.Reader, format string, a ...interface{}) (n int, err os.Error) // scanError represents an error generated by the scanning software. // It's used as a unique signature to identify such errors when recovering. type scanError struct { - err os.Error + err error } const eof = -1 @@ -170,11 +171,11 @@ type ssave struct { // The Read method is only in ScanState so that ScanState // satisfies io.Reader. It will never be called when used as // intended, so there is no need to make it actually work. -func (s *ss) Read(buf []byte) (n int, err os.Error) { - return 0, os.NewError("ScanState's Read should not be called. Use ReadRune") +func (s *ss) Read(buf []byte) (n int, err error) { + return 0, errors.New("ScanState's Read should not be called. Use ReadRune") } -func (s *ss) ReadRune() (r rune, size int, err os.Error) { +func (s *ss) ReadRune() (r rune, size int, err error) { if s.peekRune >= 0 { s.count++ r = s.peekRune @@ -184,7 +185,7 @@ func (s *ss) ReadRune() (r rune, size int, err os.Error) { return } if s.atEOF || s.nlIsEnd && s.prevRune == '\n' || s.count >= s.fieldLimit { - err = os.EOF + err = io.EOF return } @@ -192,7 +193,7 @@ func (s *ss) ReadRune() (r rune, size int, err os.Error) { if err == nil { s.count++ s.prevRune = r - } else if err == os.EOF { + } else if err == io.EOF { s.atEOF = true } return @@ -210,7 +211,7 @@ func (s *ss) Width() (wid int, ok bool) { func (s *ss) getRune() (r rune) { r, _, err := s.ReadRune() if err != nil { - if err == os.EOF { + if err == io.EOF { return eof } s.error(err) @@ -229,7 +230,7 @@ func (s *ss) mustReadRune() (r rune) { return } -func (s *ss) UnreadRune() os.Error { +func (s *ss) UnreadRune() error { if u, ok := s.rr.(runeUnreader); ok { u.UnreadRune() } else { @@ -240,15 +241,15 @@ func (s *ss) UnreadRune() os.Error { return nil } -func (s *ss) error(err os.Error) { +func (s *ss) error(err error) { panic(scanError{err}) } func (s *ss) errorString(err string) { - panic(scanError{os.NewError(err)}) + panic(scanError{errors.New(err)}) } -func (s *ss) Token(skipSpace bool, f func(rune) bool) (tok []byte, err os.Error) { +func (s *ss) Token(skipSpace bool, f func(rune) bool) (tok []byte, err error) { defer func() { if e := recover(); e != nil { if se, ok := e.(scanError); ok { @@ -289,7 +290,7 @@ type readRune struct { // readByte returns the next byte from the input, which may be // left over from a previous read if the UTF-8 was ill-formed. -func (r *readRune) readByte() (b byte, err os.Error) { +func (r *readRune) readByte() (b byte, err error) { if r.pending > 0 { b = r.pendBuf[0] copy(r.pendBuf[0:], r.pendBuf[1:]) @@ -308,7 +309,7 @@ func (r *readRune) unread(buf []byte) { // ReadRune returns the next UTF-8 encoded code point from the // io.Reader inside r. -func (r *readRune) ReadRune() (rr rune, size int, err os.Error) { +func (r *readRune) ReadRune() (rr rune, size int, err error) { r.buf[0], err = r.readByte() if err != nil { return 0, 0, err @@ -321,7 +322,7 @@ func (r *readRune) ReadRune() (rr rune, size int, err os.Error) { for n = 1; !utf8.FullRune(r.buf[0:n]); n++ { r.buf[n], err = r.readByte() if err != nil { - if err == os.EOF { + if err == io.EOF { err = nil break } @@ -435,8 +436,8 @@ func (s *ss) typeError(field interface{}, expected string) { s.errorString("expected field of type pointer to " + expected + "; found " + reflect.TypeOf(field).String()) } -var complexError = os.NewError("syntax error scanning complex number") -var boolError = os.NewError("syntax error scanning boolean") +var complexError = errors.New("syntax error scanning complex number") +var boolError = errors.New("syntax error scanning boolean") // consume reads the next rune in the input and reports whether it is in the ok string. // If accept is true, it puts the character into the input token. @@ -469,7 +470,7 @@ func (s *ss) peek(ok string) bool { func (s *ss) notEOF() { // Guarantee there is data to be read. if r := s.getRune(); r == eof { - panic(os.EOF) + panic(io.EOF) } s.UnreadRune() } @@ -874,12 +875,12 @@ const hugeWid = 1 << 30 // scanOne scans a single value, deriving the scanner from the type of the argument. func (s *ss) scanOne(verb rune, field interface{}) { s.buf.Reset() - var err os.Error + var err error // If the parameter has its own Scan method, use that. if v, ok := field.(Scanner); ok { err = v.Scan(s, verb) if err != nil { - if err == os.EOF { + if err == io.EOF { err = io.ErrUnexpectedEOF } s.error(err) @@ -976,11 +977,11 @@ func (s *ss) scanOne(verb rune, field interface{}) { } // errorHandler turns local panics into error returns. -func errorHandler(errp *os.Error) { +func errorHandler(errp *error) { if e := recover(); e != nil { if se, ok := e.(scanError); ok { // catch local error *errp = se.err - } else if eof, ok := e.(os.Error); ok && eof == os.EOF { // out of input + } else if eof, ok := e.(error); ok && eof == io.EOF { // out of input *errp = eof } else { panic(e) @@ -989,7 +990,7 @@ func errorHandler(errp *os.Error) { } // doScan does the real work for scanning without a format string. -func (s *ss) doScan(a []interface{}) (numProcessed int, err os.Error) { +func (s *ss) doScan(a []interface{}) (numProcessed int, err error) { defer errorHandler(&err) for _, field := range a { s.scanOne('v', field) @@ -1061,7 +1062,7 @@ func (s *ss) advance(format string) (i int) { // doScanf does the real work when scanning with a format string. // At the moment, it handles only pointers to basic types. -func (s *ss) doScanf(format string, a []interface{}) (numProcessed int, err os.Error) { +func (s *ss) doScanf(format string, a []interface{}) (numProcessed int, err error) { defer errorHandler(&err) end := len(format) - 1 // We process one item per non-trivial format diff --git a/libgo/go/fmt/scan_test.go b/libgo/go/fmt/scan_test.go index fbc28c1..7dd0015 100644 --- a/libgo/go/fmt/scan_test.go +++ b/libgo/go/fmt/scan_test.go @@ -7,10 +7,10 @@ package fmt_test import ( "bufio" "bytes" + "errors" . "fmt" "io" "math" - "os" "reflect" "regexp" "strings" @@ -87,14 +87,14 @@ type FloatTest struct { // Xs accepts any non-empty run of the verb character type Xs string -func (x *Xs) Scan(state ScanState, verb rune) os.Error { +func (x *Xs) Scan(state ScanState, verb rune) error { tok, err := state.Token(true, func(r rune) bool { return r == verb }) if err != nil { return err } s := string(tok) if !regexp.MustCompile("^" + string(verb) + "+$").MatchString(s) { - return os.NewError("syntax error for xs") + return errors.New("syntax error for xs") } *x = Xs(s) return nil @@ -109,7 +109,7 @@ type IntString struct { s string } -func (s *IntString) Scan(state ScanState, verb rune) os.Error { +func (s *IntString) Scan(state ScanState, verb rune) error { if _, err := Fscan(state, &s.i); err != nil { return err } @@ -130,7 +130,7 @@ type myStringReader struct { r *strings.Reader } -func (s *myStringReader) Read(p []byte) (n int, err os.Error) { +func (s *myStringReader) Read(p []byte) (n int, err error) { return s.r.Read(p) } @@ -350,7 +350,7 @@ var multiTests = []ScanfMultiTest{ {"%c%c%c", "\xc2X\xc2", args(&i, &j, &k), args(utf8.RuneError, 'X', utf8.RuneError), ""}, } -func testScan(name string, t *testing.T, scan func(r io.Reader, a ...interface{}) (int, os.Error)) { +func testScan(name string, t *testing.T, scan func(r io.Reader, a ...interface{}) (int, error)) { for _, test := range scanTests { var r io.Reader if name == "StringReader" { @@ -431,7 +431,7 @@ func TestScanOverflow(t *testing.T) { t.Errorf("expected overflow scanning %q", test.text) continue } - if !re.MatchString(err.String()) { + if !re.MatchString(err.Error()) { t.Errorf("expected overflow error scanning %q: %s", test.text, err) } } @@ -500,7 +500,7 @@ func testScanfMulti(name string, t *testing.T) { if err != nil { if test.err == "" { t.Errorf("got error scanning (%q, %q): %q", test.format, test.text, err) - } else if strings.Index(err.String(), test.err) < 0 { + } else if strings.Index(err.Error(), test.err) < 0 { t.Errorf("got wrong error scanning (%q, %q): %q; expected %q", test.format, test.text, err, test.err) } continue @@ -594,7 +594,7 @@ func TestScanNotPointer(t *testing.T) { _, err := Fscan(r, a) if err == nil { t.Error("expected error scanning non-pointer") - } else if strings.Index(err.String(), "pointer") < 0 { + } else if strings.Index(err.Error(), "pointer") < 0 { t.Errorf("expected pointer error scanning non-pointer, got: %s", err) } } @@ -604,7 +604,7 @@ func TestScanlnNoNewline(t *testing.T) { _, err := Sscanln("1 x\n", &a) if err == nil { t.Error("expected error scanning string missing newline") - } else if strings.Index(err.String(), "newline") < 0 { + } else if strings.Index(err.Error(), "newline") < 0 { t.Errorf("expected newline error scanning string missing newline, got: %s", err) } } @@ -615,7 +615,7 @@ func TestScanlnWithMiddleNewline(t *testing.T) { _, err := Fscanln(r, &a, &b) if err == nil { t.Error("expected error scanning string with extra newline") - } else if strings.Index(err.String(), "newline") < 0 { + } else if strings.Index(err.Error(), "newline") < 0 { t.Errorf("expected newline error scanning string with extra newline, got: %s", err) } } @@ -626,7 +626,7 @@ type eofCounter struct { eofCount int } -func (ec *eofCounter) Read(b []byte) (n int, err os.Error) { +func (ec *eofCounter) Read(b []byte) (n int, err error) { n, err = ec.reader.Read(b) if n == 0 { ec.eofCount++ @@ -670,14 +670,14 @@ func TestEOFAtEndOfInput(t *testing.T) { if n != 1 || i != 23 { t.Errorf("Sscanf expected one value of 23; got %d %d", n, i) } - if err != os.EOF { + if err != io.EOF { t.Errorf("Sscanf expected EOF; got %q", err) } n, err = Sscan("234", &i, &j) if n != 1 || i != 234 { t.Errorf("Sscan expected one value of 234; got %d %d", n, i) } - if err != os.EOF { + if err != io.EOF { t.Errorf("Sscan expected EOF; got %q", err) } // Trailing space is tougher. @@ -685,7 +685,7 @@ func TestEOFAtEndOfInput(t *testing.T) { if n != 1 || i != 234 { t.Errorf("Sscan expected one value of 234; got %d %d", n, i) } - if err != os.EOF { + if err != io.EOF { t.Errorf("Sscan expected EOF; got %q", err) } } @@ -715,10 +715,10 @@ var eofTests = []struct { func TestEOFAllTypes(t *testing.T) { for i, test := range eofTests { - if _, err := Sscanf("", test.format, test.v); err != os.EOF { + if _, err := Sscanf("", test.format, test.v); err != io.EOF { t.Errorf("#%d: %s %T not eof on empty string: %s", i, test.format, test.v, err) } - if _, err := Sscanf(" ", test.format, test.v); err != os.EOF { + if _, err := Sscanf(" ", test.format, test.v); err != io.EOF { t.Errorf("#%d: %s %T not eof on trailing blanks: %s", i, test.format, test.v, err) } } @@ -749,7 +749,7 @@ type TwoLines string // Attempt to read two lines into the object. Scanln should prevent this // because it stops at newline; Scan and Scanf should be fine. -func (t *TwoLines) Scan(state ScanState, verb rune) os.Error { +func (t *TwoLines) Scan(state ScanState, verb rune) error { chars := make([]rune, 0, 100) for nlCount := 0; nlCount < 2; { c, _, err := state.ReadRune() @@ -812,7 +812,7 @@ type RecursiveInt struct { next *RecursiveInt } -func (r *RecursiveInt) Scan(state ScanState, verb rune) (err os.Error) { +func (r *RecursiveInt) Scan(state ScanState, verb rune) (err error) { _, err = Fscan(state, &r.i) if err != nil { return @@ -820,7 +820,7 @@ func (r *RecursiveInt) Scan(state ScanState, verb rune) (err os.Error) { next := new(RecursiveInt) _, err = Fscanf(state, ".%v", next) if err != nil { - if err == os.NewError("input does not match format") || err == io.ErrUnexpectedEOF { + if err == errors.New("input does not match format") || err == io.ErrUnexpectedEOF { err = nil } return @@ -832,7 +832,7 @@ func (r *RecursiveInt) Scan(state ScanState, verb rune) (err os.Error) { // Perform the same scanning task as RecursiveInt.Scan // but without recurring through scanner, so we can compare // performance more directly. -func scanInts(r *RecursiveInt, b *bytes.Buffer) (err os.Error) { +func scanInts(r *RecursiveInt, b *bytes.Buffer) (err error) { r.next = nil _, err = Fscan(b, &r.i) if err != nil { @@ -840,7 +840,7 @@ func scanInts(r *RecursiveInt, b *bytes.Buffer) (err os.Error) { } c, _, err := b.ReadRune() if err != nil { - if err == os.EOF { + if err == io.EOF { err = nil } return @@ -867,7 +867,7 @@ func makeInts(n int) []byte { func TestScanInts(t *testing.T) { testScanInts(t, scanInts) - testScanInts(t, func(r *RecursiveInt, b *bytes.Buffer) (err os.Error) { + testScanInts(t, func(r *RecursiveInt, b *bytes.Buffer) (err error) { _, err = Fscan(b, r) return }) @@ -877,7 +877,7 @@ func TestScanInts(t *testing.T) { // platform that does not support split stack. const intCount = 800 -func testScanInts(t *testing.T, scan func(*RecursiveInt, *bytes.Buffer) os.Error) { +func testScanInts(t *testing.T, scan func(*RecursiveInt, *bytes.Buffer) error) { r := new(RecursiveInt) ints := makeInts(intCount) buf := bytes.NewBuffer(ints) -- cgit v1.1