if no arguments, return error at once

This commit is contained in:
Baiju Muthukadan 2016-10-07 17:12:29 +05:30
parent ab703afe97
commit 0d54677e13
1 changed files with 30 additions and 30 deletions

View File

@ -44,7 +44,8 @@ func Open(dialect string, args ...interface{}) (*DB, error) {
if len(args) == 0 { if len(args) == 0 {
err = errors.New("invalid database source") err = errors.New("invalid database source")
} else { return nil, err
}
var source string var source string
var dbSQL sqlCommon var dbSQL sqlCommon
@ -79,7 +80,6 @@ func Open(dialect string, args ...interface{}) (*DB, error) {
db.DB().Close() db.DB().Close()
} }
} }
}
return &db, err return &db, err
} }