my project need to import two package ,while each one registe mysql driver,I got panic with panic: sql: Register called twice for driver mysql
how to resolve this
You will need to re-structure your project somehow so that you don't import both drivers in the same process.
Usually, packages implementing SQL drivers would have an "init()" function in which they would do something like:
sql.Register("mysql", &MySQLDriver{})
See for example: https://github.com/go-sql-driver/mysql/blob/master/driver.go#L182
But the Register function will throw an error if the same driver name is registered twice as stated in the docs: https://golang.org/pkg/database/sql/#Register
Reason for this is that you'd then try to do this to actually use the driver:
db, err := sql.Open("mysql", someDBUrl)
So how should the sql library determine the driver to use if it'd let you register more than one under the same name?