release 版执行错误
aloasut opened this issue · comments
错误:
error] failed to initialize database, got error Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
FATA[2023-05-24 02:17:38]/github/workspace/pkg/logger/logger.go:45 github.com/xbmlz/chatgpt-plus-dingtalk/pkg/logger.Fatal() failed to open sqlite3: %vBinary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub
GPT说:
您收到的错误信息指出:Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work.
这意味着您尝试运行的程序已编译为不使用cgo,但是go-sqlite3库需要cgo才能工作。
cgo允许Go程序调用C库,而在您的情况中,go-sqlite3库需要使用cgo才能正常工作。然而,你的程序在编译时禁用了cgo,这就是问题所在。
为解决此问题,您需要重新编译您的程序,并确保在编译时启用cgo。在命令行中,您可以这样设置环境变量CGO_ENABLED
:
CGO_ENABLED=1 go build
这条命令将使cgo在编译程序时被启用。如果您正在使用的是某种构建工具或构建脚本,您可能需要检查该工具或脚本的配置以确保启用了cgo。
v0.0.2已修复