时间:2021-07-01 10:21:17 帮助过:5人阅读
iferr!=nil{
fmt.Printf("Error connecting to MySQL on '%s': n",hostToCheck,err)
db.Close()
os.Exit(1)
}
//Checkconnectionisalive.
err=db.Ping()
iferr!=nil{
fmt.Printf("Unable to ping mysql at '%s': %sn",hostToCheck,err)
db.Close()
os.Exit(1)
}