【数据库连接】连接sqlite3报错:go-sqlite3 requires cgo to work. This is a stub

报错信息

register db Ping default, Binary was compiled with ‘CGO_ENABLED=0’, go-sqlite3 requires cgo to work. This is a stub

Windows解决办法

新建环境变量

【数据库连接】连接sqlite3报错:go-sqlite3 requires cgo to work. This is a stub_第1张图片

新报错

Failed to build the application: # runtime/cgo
cgo: C compiler “gcc” not found: exec: “gcc”: executable file not found in %PATH%

安装GCC

官网:https://gitcode.com/mattn/go-sqlite3/tree/master?utm_source=csdn_github_accelerator&isLogin=1
【数据库连接】连接sqlite3报错:go-sqlite3 requires cgo to work. This is a stub_第2张图片

下载

【数据库连接】连接sqlite3报错:go-sqlite3 requires cgo to work. This is a stub_第3张图片

安装

【数据库连接】连接sqlite3报错:go-sqlite3 requires cgo to work. This is a stub_第4张图片
【数据库连接】连接sqlite3报错:go-sqlite3 requires cgo to work. This is a stub_第5张图片
【数据库连接】连接sqlite3报错:go-sqlite3 requires cgo to work. This is a stub_第6张图片

这样就可以解决了!

你可能感兴趣的:(go语言,数据库,sqlite,golang)