Skip to content

Commit

Permalink
Drop support for Go 1.0 from the master branch
Browse files Browse the repository at this point in the history
There's still a "go1.0" branch if you really need to build on Go 1.0,
but it will only receive critical bug fixes from now on.  The cut-off
point was also tagged with "go1.0-cutoff".
  • Loading branch information
johto committed Dec 23, 2014
1 parent 5da8732 commit 71079a8
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 102 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
language: go

go:
- 1.0.2
- 1.0.3
- 1.1
- 1.2
- 1.3
Expand Down
15 changes: 1 addition & 14 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ func (s transactionStatus) String() string {
default:
errorf("unknown transactionStatus %d", s)
}

panic("not reached")
}

Expand Down Expand Up @@ -490,7 +491,6 @@ func (cn *conn) simpleExec(q string) (res driver.Result, commandTag string, err
errorf("unknown response for simple query: %q", t)
}
}
panic("not reached")
}

func (cn *conn) simpleQuery(q string) (res driver.Rows, err error) {
Expand Down Expand Up @@ -543,7 +543,6 @@ func (cn *conn) simpleQuery(q string) (res driver.Rows, err error) {
errorf("unknown response for simple query: %q", t)
}
}
panic("not reached")
}

func (cn *conn) prepareTo(q, stmtName string) (_ *stmt, err error) {
Expand Down Expand Up @@ -587,8 +586,6 @@ func (cn *conn) prepareTo(q, stmtName string) (_ *stmt, err error) {
errorf("unexpected describe rows response: %q", t)
}
}

panic("not reached")
}

func (cn *conn) Prepare(q string) (_ driver.Stmt, err error) {
Expand Down Expand Up @@ -766,8 +763,6 @@ func (cn *conn) recv() (t byte, r *readBuf) {
return
}
}

panic("not reached")
}

// recv1Buf is exactly equivalent to recv1, except it uses a buffer supplied by
Expand All @@ -788,8 +783,6 @@ func (cn *conn) recv1Buf(r *readBuf) byte {
return t
}
}

panic("not reached")
}

// recv1 receives a message from the backend, panicking if an error occurs
Expand Down Expand Up @@ -967,7 +960,6 @@ func isDriverSetting(key string) bool {
default:
return false
}
panic("not reached")
}

func (cn *conn) startup(o values) {
Expand Down Expand Up @@ -1124,8 +1116,6 @@ func (st *stmt) Exec(v []driver.Value) (res driver.Result, err error) {
errorf("unknown exec response: %q", t)
}
}

panic("not reached")
}

func (st *stmt) exec(v []driver.Value) {
Expand Down Expand Up @@ -1287,7 +1277,6 @@ func (rs *rows) Close() error {
return err
}
}
panic("not reached")
}

func (rs *rows) Columns() []string {
Expand Down Expand Up @@ -1337,8 +1326,6 @@ func (rs *rows) Next(dest []driver.Value) (err error) {
errorf("unexpected message after execute: %q", t)
}
}

panic("not reached")
}

// QuoteIdentifier quotes an "identifier" (e.g. a table or a column name) to be
Expand Down
67 changes: 54 additions & 13 deletions conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import (
"io"
"os"
"reflect"
"runtime"
"strings"
"testing"
"time"
)
Expand Down Expand Up @@ -56,12 +54,6 @@ func getServerVersion(t *testing.T, db *sql.DB) int {
}

func TestReconnect(t *testing.T) {
if runtime.Version() == "go1.0.2" {
fmt.Println("Skipping failing test; " +
"fixed in database/sql on go1.0.3+")
return
}

db1 := openTestConn(t)
defer db1.Close()
tx, err := db1.Begin()
Expand Down Expand Up @@ -838,11 +830,6 @@ func TestIssue196(t *testing.T) {
// Test that any CommandComplete messages sent before the query results are
// ignored.
func TestIssue282(t *testing.T) {
if strings.HasPrefix(runtime.Version(), "go1.0") {
fmt.Println("Skipping test due to lack of Queryer implementation")
return
}

db := openTestConn(t)
defer db.Close()

Expand Down Expand Up @@ -878,6 +865,60 @@ func TestReadFloatPrecision(t *testing.T) {
}
}

func TestXactMultiStmt(t *testing.T) {
// minified test case based on bug reports from
// pico303@gmail.com and rangelspam@gmail.com
t.Skip("Skipping failing test")
db := openTestConn(t)
defer db.Close()

tx, err := db.Begin()
if err != nil {
t.Fatal(err)
}
defer tx.Commit()

rows, err := tx.Query("select 1")
if err != nil {
t.Fatal(err)
}

if rows.Next() {
var val int32
if err = rows.Scan(&val); err != nil {
t.Fatal(err)
}
} else {
t.Fatal("Expected at least one row in first query in xact")
}

rows2, err := tx.Query("select 2")
if err != nil {
t.Fatal(err)
}

if rows2.Next() {
var val2 int32
if err := rows2.Scan(&val2); err != nil {
t.Fatal(err)
}
} else {
t.Fatal("Expected at least one row in second query in xact")
}

if err = rows.Err(); err != nil {
t.Fatal(err)
}

if err = rows2.Err(); err != nil {
t.Fatal(err)
}

if err = tx.Commit(); err != nil {
t.Fatal(err)
}
}

var envParseTests = []struct {
Expected map[string]string
Env []string
Expand Down
61 changes: 0 additions & 61 deletions conn_xact_test.go

This file was deleted.

2 changes: 0 additions & 2 deletions copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ awaitCopyInResponse:
errorf("unknown response for CopyFail: %q", t)
}
}

panic("not reached")
}

func (ci *copyin) flush(buf []byte) {
Expand Down
6 changes: 0 additions & 6 deletions notify.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,6 @@ func (l *ListenerConn) listenerConnLoop() (err error) {
return fmt.Errorf("unexpected message %q from server in listenerConnLoop", t)
}
}

panic("not reached")
}

// This is the main routine for the goroutine receiving on the database
Expand Down Expand Up @@ -318,8 +316,6 @@ func (l *ListenerConn) ExecSimpleQuery(q string) (executed bool, err error) {
return false, fmt.Errorf("unknown response for simple query: %q", m.typ)
}
}

panic("not reached")
}

func (l *ListenerConn) Close() error {
Expand Down Expand Up @@ -631,8 +627,6 @@ func (l *Listener) resync(cn *ListenerConn, notificationChan <-chan *Notificatio
return err
}
}

panic("not reached")
}

// caller should NOT be holding l.lock
Expand Down
4 changes: 0 additions & 4 deletions notify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ func expectNotification(t *testing.T, ch <-chan *Notification, relname string, e
case <-time.After(1500 * time.Millisecond):
return fmt.Errorf("timeout")
}
panic("not reached")
}

func expectNoNotification(t *testing.T, ch <-chan *Notification) error {
Expand All @@ -34,7 +33,6 @@ func expectNoNotification(t *testing.T, ch <-chan *Notification) error {
case <-time.After(100 * time.Millisecond):
return nil
}
panic("not reached")
}

func expectEvent(t *testing.T, eventch <-chan ListenerEventType, et ListenerEventType) error {
Expand All @@ -47,7 +45,6 @@ func expectEvent(t *testing.T, eventch <-chan ListenerEventType, et ListenerEven
case <-time.After(1500 * time.Millisecond):
return fmt.Errorf("timeout")
}
panic("not reached")
}

func expectNoEvent(t *testing.T, eventch <-chan ListenerEventType) error {
Expand All @@ -57,7 +54,6 @@ func expectNoEvent(t *testing.T, eventch <-chan ListenerEventType) error {
case <-time.After(100 * time.Millisecond):
return nil
}
panic("not reached")
}

func newTestListenerConn(t *testing.T) (*ListenerConn, <-chan *Notification) {
Expand Down

0 comments on commit 71079a8

Please sign in to comment.