1
0
mirror of https://github.com/golang/go synced 2024-11-21 22:44:40 -07:00

pkg: minor cleanup

remove some redundant .String()
change variable name to make it os.Error-proof

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5302075
This commit is contained in:
Russ Cox 2011-10-31 17:53:39 -04:00
parent a07841e21e
commit 92926f5472
3 changed files with 5 additions and 5 deletions

View File

@ -60,10 +60,10 @@ type directoryEnd struct {
comment string comment string
} }
func recoverError(err *os.Error) { func recoverError(errp *os.Error) {
if e := recover(); e != nil { if e := recover(); e != nil {
if osErr, ok := e.(os.Error); ok { if err, ok := e.(os.Error); ok {
*err = osErr *errp = err
return return
} }
panic(e) panic(e)

View File

@ -536,7 +536,7 @@ func TestScan(t *testing.T) {
buf.Reset() buf.Reset()
buf.WriteString(test.input) buf.WriteString(test.input)
if _, err := fmt.Fscanf(&buf, test.format, x); err != nil { if _, err := fmt.Fscanf(&buf, test.format, x); err != nil {
t.Errorf("#%d error: %s", i, err.String()) t.Errorf("#%d error: %s", i, err)
} }
if x.String() != test.output { if x.String() != test.output {
t.Errorf("#%d got %s; want %s", i, x.String(), test.output) t.Errorf("#%d got %s; want %s", i, x.String(), test.output)

View File

@ -112,7 +112,7 @@ func TestRatScan(t *testing.T) {
_, err := fmt.Fscanf(&buf, "%v", x) _, err := fmt.Fscanf(&buf, "%v", x)
if err == nil != test.ok { if err == nil != test.ok {
if test.ok { if test.ok {
t.Errorf("#%d error: %s", i, err.String()) t.Errorf("#%d error: %s", i, err)
} else { } else {
t.Errorf("#%d expected error", i) t.Errorf("#%d expected error", i)
} }