package database import ( "database/sql" "log" _ "github.com/go-sql-driver/mysql" ) var DB *sql.DB func Init(dataSourceName string) error { var err error DB, err = sql.Open("mysql", dataSourceName) if err != nil { log.Panic(err) } if err = DB.Ping(); err != nil { log.Panic(err) } return err }