diff --git a/main.go b/main.go index 65ed4fd5..f4aa5573 100644 --- a/main.go +++ b/main.go @@ -114,7 +114,7 @@ func (s *DB) CopyDB() (*sql.DB, error) { if s.copyDB != nil { return s.copyDB, nil } - return sql.Open(s.Dialect().GetName(), s.DataSource()) + return sql.Open(s.Dialect().GetName(), s.DataSource()) } type closer interface { diff --git a/main_test.go b/main_test.go index 62e798b1..03eaf8e7 100644 --- a/main_test.go +++ b/main_test.go @@ -1061,8 +1061,8 @@ func TestBlockGlobalUpdate(t *testing.T) { func TestDB_DataSource(t *testing.T) { source := "user=gorm password=gorm DB.name=gorm port=9920 sslmode=disable" - db,er := gorm.Open("postgres", source) - if er!=nil { + db, er := gorm.Open("postgres", source) + if er != nil { panic(fmt.Sprintf("No error should happen when connecting to test database, but got err=%+v", er)) } if db.DataSource() != source { @@ -1072,12 +1072,12 @@ func TestDB_DataSource(t *testing.T) { } func TestDB_CopyIn(t *testing.T) { source := "user=gorm password=gorm DB.name=gorm port=9920 sslmode=disable" - db,er := gorm.Open("postgres", source) - if er!=nil { + db, er := gorm.Open("postgres", source) + if er != nil { panic(fmt.Sprintf("No error should happen when connecting to test database, but got err=%+v", er)) } - e:=db.Exec("create table if not exists example(name varchar, age integer)").Error - defer func(){ + e := db.Exec("create table if not exists example(name varchar, age integer)").Error + defer func() { er := db.Exec("drop table if exists example").Error if er != nil { t.Fatal(e.Error())