src/pkg/[a-m]*: gofix -r error -force=error
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5322051
diff --git a/src/pkg/exp/sql/fakedb_test.go b/src/pkg/exp/sql/fakedb_test.go
index c906185..289294b 100644
--- a/src/pkg/exp/sql/fakedb_test.go
+++ b/src/pkg/exp/sql/fakedb_test.go
@@ -5,9 +5,10 @@
package sql
import (
+ "errors"
"fmt"
+ "io"
"log"
- "os"
"strconv"
"strings"
"sync"
@@ -108,7 +109,7 @@
// Supports dsn forms:
// <dbname>
// <dbname>;wipe
-func (d *fakeDriver) Open(dsn string) (driver.Conn, os.Error) {
+func (d *fakeDriver) Open(dsn string) (driver.Conn, error) {
d.mu.Lock()
defer d.mu.Unlock()
d.openCount++
@@ -117,7 +118,7 @@
}
parts := strings.Split(dsn, ";")
if len(parts) < 1 {
- return nil, os.NewError("fakedb: no database name")
+ return nil, errors.New("fakedb: no database name")
}
name := parts[0]
db, ok := d.dbs[name]
@@ -134,7 +135,7 @@
db.tables = nil
}
-func (db *fakeDB) createTable(name string, columnNames, columnTypes []string) os.Error {
+func (db *fakeDB) createTable(name string, columnNames, columnTypes []string) error {
db.mu.Lock()
defer db.mu.Unlock()
if db.tables == nil {
@@ -175,33 +176,33 @@
return "", false
}
-func (c *fakeConn) Begin() (driver.Tx, os.Error) {
+func (c *fakeConn) Begin() (driver.Tx, error) {
if c.currTx != nil {
- return nil, os.NewError("already in a transaction")
+ return nil, errors.New("already in a transaction")
}
c.currTx = &fakeTx{c: c}
return c.currTx, nil
}
-func (c *fakeConn) Close() os.Error {
+func (c *fakeConn) Close() error {
if c.currTx != nil {
- return os.NewError("can't close; in a Transaction")
+ return errors.New("can't close; in a Transaction")
}
if c.db == nil {
- return os.NewError("can't close; already closed")
+ return errors.New("can't close; already closed")
}
c.db = nil
return nil
}
-func errf(msg string, args ...interface{}) os.Error {
- return os.NewError("fakedb: " + fmt.Sprintf(msg, args...))
+func errf(msg string, args ...interface{}) error {
+ return errors.New("fakedb: " + fmt.Sprintf(msg, args...))
}
// parts are table|selectCol1,selectCol2|whereCol=?,whereCol2=?
// (note that where where columns must always contain ? marks,
// just a limitation for fakedb)
-func (c *fakeConn) prepareSelect(stmt *fakeStmt, parts []string) (driver.Stmt, os.Error) {
+func (c *fakeConn) prepareSelect(stmt *fakeStmt, parts []string) (driver.Stmt, error) {
if len(parts) != 3 {
return nil, errf("invalid SELECT syntax with %d parts; want 3", len(parts))
}
@@ -228,7 +229,7 @@
}
// parts are table|col=type,col2=type2
-func (c *fakeConn) prepareCreate(stmt *fakeStmt, parts []string) (driver.Stmt, os.Error) {
+func (c *fakeConn) prepareCreate(stmt *fakeStmt, parts []string) (driver.Stmt, error) {
if len(parts) != 2 {
return nil, errf("invalid CREATE syntax with %d parts; want 2", len(parts))
}
@@ -245,7 +246,7 @@
}
// parts are table|col=?,col2=val
-func (c *fakeConn) prepareInsert(stmt *fakeStmt, parts []string) (driver.Stmt, os.Error) {
+func (c *fakeConn) prepareInsert(stmt *fakeStmt, parts []string) (driver.Stmt, error) {
if len(parts) != 2 {
return nil, errf("invalid INSERT syntax with %d parts; want 2", len(parts))
}
@@ -287,7 +288,7 @@
return stmt, nil
}
-func (c *fakeConn) Prepare(query string) (driver.Stmt, os.Error) {
+func (c *fakeConn) Prepare(query string) (driver.Stmt, error) {
if c.db == nil {
panic("nil c.db; conn = " + fmt.Sprintf("%#v", c))
}
@@ -317,11 +318,11 @@
return s.placeholderConverter[idx]
}
-func (s *fakeStmt) Close() os.Error {
+func (s *fakeStmt) Close() error {
return nil
}
-func (s *fakeStmt) Exec(args []interface{}) (driver.Result, os.Error) {
+func (s *fakeStmt) Exec(args []interface{}) (driver.Result, error) {
db := s.c.db
switch s.cmd {
case "WIPE":
@@ -339,7 +340,7 @@
return nil, fmt.Errorf("unimplemented statement Exec command type of %q", s.cmd)
}
-func (s *fakeStmt) execInsert(args []interface{}) (driver.Result, os.Error) {
+func (s *fakeStmt) execInsert(args []interface{}) (driver.Result, error) {
db := s.c.db
if len(args) != s.placeholders {
panic("error in pkg db; should only get here if size is correct")
@@ -375,7 +376,7 @@
return driver.RowsAffected(1), nil
}
-func (s *fakeStmt) Query(args []interface{}) (driver.Rows, os.Error) {
+func (s *fakeStmt) Query(args []interface{}) (driver.Rows, error) {
db := s.c.db
if len(args) != s.placeholders {
panic("error in pkg db; should only get here if size is correct")
@@ -438,12 +439,12 @@
return s.placeholders
}
-func (tx *fakeTx) Commit() os.Error {
+func (tx *fakeTx) Commit() error {
tx.c.currTx = nil
return nil
}
-func (tx *fakeTx) Rollback() os.Error {
+func (tx *fakeTx) Rollback() error {
tx.c.currTx = nil
return nil
}
@@ -455,7 +456,7 @@
closed bool
}
-func (rc *rowsCursor) Close() os.Error {
+func (rc *rowsCursor) Close() error {
rc.closed = true
return nil
}
@@ -464,13 +465,13 @@
return rc.cols
}
-func (rc *rowsCursor) Next(dest []interface{}) os.Error {
+func (rc *rowsCursor) Next(dest []interface{}) error {
if rc.closed {
- return os.NewError("fakedb: cursor is closed")
+ return errors.New("fakedb: cursor is closed")
}
rc.pos++
if rc.pos >= len(rc.rows) {
- return os.EOF // per interface spec
+ return io.EOF // per interface spec
}
for i, v := range rc.rows[rc.pos].cols {
// TODO(bradfitz): convert to subset types? naah, I