diff --git a/AUTHORS b/AUTHORS index 4702c83ab..301ce573f 100644 --- a/AUTHORS +++ b/AUTHORS @@ -13,6 +13,7 @@ Aaron Hopkins Achille Roussel +Alexey Palazhchenko Arne Hormann Asta Xie Bulat Gaifullin @@ -61,8 +62,8 @@ Paul Bonser Peter Schultz Rebecca Chin Reed Allman -Runrioter Wung Robert Russell +Runrioter Wung Shuode Li Soroush Pour Stan Putrya @@ -79,5 +80,6 @@ Counting Ltd. Google Inc. InfoSum Ltd. Keybase Inc. +Percona LLC Pivotal Inc. Stripe Inc. diff --git a/utils_go18.go b/utils_go18.go index 7d8c9b16e..c35c2a6aa 100644 --- a/utils_go18.go +++ b/utils_go18.go @@ -15,6 +15,7 @@ import ( "database/sql" "database/sql/driver" "errors" + "fmt" ) func cloneTLSConfig(c *tls.Config) *tls.Config { @@ -44,6 +45,6 @@ func mapIsolationLevel(level driver.IsolationLevel) (string, error) { case sql.LevelSerializable: return "SERIALIZABLE", nil default: - return "", errors.New("mysql: unsupported isolation level: " + string(level)) + return "", fmt.Errorf("mysql: unsupported isolation level: %v", level) } } diff --git a/utils_go18_test.go b/utils_go18_test.go index 856c25f56..f63dbecc4 100644 --- a/utils_go18_test.go +++ b/utils_go18_test.go @@ -17,7 +17,6 @@ import ( ) func TestIsolationLevelMapping(t *testing.T) { - data := []struct { level driver.IsolationLevel expected string @@ -47,8 +46,12 @@ func TestIsolationLevelMapping(t *testing.T) { } // check unsupported mapping - if actual, err := mapIsolationLevel(driver.IsolationLevel(sql.LevelLinearizable)); actual != "" || err == nil { + expectedErr := "mysql: unsupported isolation level: 7" + actual, err := mapIsolationLevel(driver.IsolationLevel(sql.LevelLinearizable)) + if actual != "" || err == nil { t.Fatal("Expected error on unsupported isolation level") } - + if err.Error() != expectedErr { + t.Fatalf("Expected error to be %q, got %q", expectedErr, err) + } }