Skip to content

引入pgsql驱动后,其中的inii()方法没有正常执行 #4614

@alaywn

Description

@alaywn

Go version

1.25.3

GoFrame version

2.9.7

Can this bug be reproduced with the latest release?

Option Yes

What did you do?

1.在main.go中引入了如下驱动包:

    _ "github.com/gogf/gf/contrib/drivers/clickhouse/v2"
_ "github.com/gogf/gf/contrib/drivers/dm/v2"
_ "github.com/gogf/gf/contrib/drivers/gaussdb/v2"
_ "github.com/gogf/gf/contrib/drivers/mariadb/v2"
_ "github.com/gogf/gf/contrib/drivers/mssql/v2"
_ "github.com/gogf/gf/contrib/drivers/mysql/v2"
_ "github.com/gogf/gf/contrib/drivers/oceanbase/v2"
_ "github.com/gogf/gf/contrib/drivers/oracle/v2"
_ "github.com/gogf/gf/contrib/drivers/pgsql/v2"
_ "github.com/gogf/gf/contrib/drivers/sqlite/v2"
_ "github.com/gogf/gf/contrib/drivers/sqlitecgo/v2"
_ "github.com/gogf/gf/contrib/drivers/tidb/v2"

2.正常启动项目

3.在每个包的init()方法中打断点,发现clickhouse中的init()是执行的,但是pgsql中的init()方法没有执行

PS: 除了pgsql驱动有这个问题外,还有其他驱动包中的init()方法,也没有执行。

What did you see happen?

项目启动失败,报错提示:

panic: cannot find database driver for specified database type "pgsql", did you misspell type name "pgsql" or forget importing the database driver?

What did you expect to see?

预期结果应该是每个导入的驱动包的init()方法都应该被执行

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions